Skip to content

Commit 3769aee

Browse files
author
deiu
committed
Added more tests for DELETE
1 parent e11c6a3 commit 3769aee

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

test/http.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,35 @@ describe('HTTP APIs', function () {
288288
server.delete('/put-resource-1.ttl')
289289
.expect(200, done)
290290
})
291+
it('should fail to delete non-empty containers', function (done) {
292+
server.put('/fooo/bar.ttl')
293+
.set('content-type', 'text/turtle')
294+
.expect(function () {
295+
server.delete('/fooo/')
296+
.expect(function () {
297+
fs.unlinkSync(__dirname + '/resources/fooo/bar.ttl')
298+
fs.rmdirSync(__dirname + '/resources/fooo/')
299+
})
300+
.expect(409)
301+
})
302+
.expect(201, done)
303+
})
304+
it('should delete a new and empty container', function (done) {
305+
server.post('/')
306+
.set('content-type', 'text/turtle')
307+
.set('slug', 'fooo')
308+
.set('link', '<http://www.w3.org/ns/ldp#BasicContainer>; rel="type"')
309+
.set('content-type', 'text/turtle')
310+
.expect(function () {
311+
server.delete('/fooo/')
312+
.expect(function () {
313+
server.get('/fooo/')
314+
.expect(404)
315+
})
316+
.expect(200)
317+
})
318+
.expect(201, done)
319+
})
291320
})
292321

293322
describe('POST API', function () {

0 commit comments

Comments
 (0)