Skip to content

Commit

Permalink
test: Notification when Creating/Deleting Container in Container
Browse files Browse the repository at this point in the history
Added tests to check that PREP notifications are correctly emitted on a container, when a container inside it is created or deleted.
  • Loading branch information
CxRes committed Oct 23, 2024
1 parent 1f6c16f commit c933a74
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/integration/prep-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,35 @@ solid:inserts { <u> <v> <z>. }.`
expect(notification.origin).to.match(/sampleContainer\/.*example-prep.ttl$/)
})

it('when a contained container is created', async function () {
await fetch('http://localhost:8443/sampleContainer/example-prep/', {
method: 'PUT',
headers: {
'Content-Type': 'text/turtle'
}
})
const { value } = await notificationsIterator.next()
expect(value.headers.get('content-type')).to.match(/application\/ld\+json/)
const notification = await value.json()
expect(notification).to.haveOwnProperty('published')
expect(notification.type).to.equal('Add')
expect(notification.target).to.match(/sampleContainer\/example-prep\/$/)
expect(notification.object).to.match(/sampleContainer\/$/)
})

it('when a contained container is deleted', async function () {
await fetch('http://localhost:8443/sampleContainer/example-prep/', {
method: 'DELETE'
})
const { value } = await notificationsIterator.next()
expect(value.headers.get('content-type')).to.match(/application\/ld\+json/)
const notification = await value.json()
expect(notification).to.haveOwnProperty('published')
expect(notification.type).to.equal('Remove')
expect(notification.origin).to.match(/sampleContainer\/example-prep\/$/)
expect(notification.object).to.match(/sampleContainer\/$/)
})

it('when a container is created by POST',
async function () {
await fetch('http://localhost:8443/sampleContainer/', {
Expand Down

0 comments on commit c933a74

Please sign in to comment.