Skip to content

Commit c933a74

Browse files
committed
test: Notification when Creating/Deleting Container in Container
Added tests to check that PREP notifications are correctly emitted on a container, when a container inside it is created or deleted.
1 parent 1f6c16f commit c933a74

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/integration/prep-test.js

+29
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,35 @@ solid:inserts { <u> <v> <z>. }.`
130130
expect(notification.origin).to.match(/sampleContainer\/.*example-prep.ttl$/)
131131
})
132132

133+
it('when a contained container is created', async function () {
134+
await fetch('http://localhost:8443/sampleContainer/example-prep/', {
135+
method: 'PUT',
136+
headers: {
137+
'Content-Type': 'text/turtle'
138+
}
139+
})
140+
const { value } = await notificationsIterator.next()
141+
expect(value.headers.get('content-type')).to.match(/application\/ld\+json/)
142+
const notification = await value.json()
143+
expect(notification).to.haveOwnProperty('published')
144+
expect(notification.type).to.equal('Add')
145+
expect(notification.target).to.match(/sampleContainer\/example-prep\/$/)
146+
expect(notification.object).to.match(/sampleContainer\/$/)
147+
})
148+
149+
it('when a contained container is deleted', async function () {
150+
await fetch('http://localhost:8443/sampleContainer/example-prep/', {
151+
method: 'DELETE'
152+
})
153+
const { value } = await notificationsIterator.next()
154+
expect(value.headers.get('content-type')).to.match(/application\/ld\+json/)
155+
const notification = await value.json()
156+
expect(notification).to.haveOwnProperty('published')
157+
expect(notification.type).to.equal('Remove')
158+
expect(notification.origin).to.match(/sampleContainer\/example-prep\/$/)
159+
expect(notification.object).to.match(/sampleContainer\/$/)
160+
})
161+
133162
it('when a container is created by POST',
134163
async function () {
135164
await fetch('http://localhost:8443/sampleContainer/', {

0 commit comments

Comments
 (0)