Skip to content

Commit

Permalink
fixed todo and added .meta test in patch-test
Browse files Browse the repository at this point in the history
  • Loading branch information
zg009 committed Mar 25, 2024
1 parent d56cdf0 commit e4bb2e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
16 changes: 9 additions & 7 deletions test/integration/http-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,13 +891,6 @@ describe('HTTP APIs', function () {
.set('content-type', 'text/turtle')
.expect(403, done)
})
it('should not error with 400 if slug contains invalid suffix', function (done) { // TODO find better name
server.post('/post-tests/')
.set('slug', 'put-resource.acl.ttl')
.send(postRequest1Body)
.set('content-type', 'text-turtle')
.expect(201, done)
})
it('should error with 400 if the body is empty and no content type is provided', function (done) {
server.post('/post-tests/')
.set('slug', 'post-resource-empty-fail')
Expand All @@ -921,6 +914,15 @@ describe('HTTP APIs', function () {
.expect(hasHeader('acl', suffixAcl))
.expect(201, done)
})
it('should create new resource even if slug contains invalid suffix', function (done) {
server.post('/post-tests/')
.set('slug', 'put-resource.acl.ttl')
.send(postRequest1Body)
.set('content-type', 'text-turtle')
.expect(hasHeader('describedBy', suffixMeta))
.expect(hasHeader('acl', suffixAcl))
.expect(201, done)
})
it('should fail return 404 if no parent container found', function (done) {
server.post('/hello.html/')
.send(postRequest1Body)
Expand Down
12 changes: 11 additions & 1 deletion test/integration/patch-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe('PATCH through text/n3', () => {
result: '@prefix : </new.n3#>.\n@prefix tim: </>.\n\ntim:x tim:y tim:z.\n\n'
}))

describe('on an N3 file that has an invalid uri', describePatch({
describe('on an N3 file that has an invalid uri (*.acl)', describePatch({
path: '/foo/bar.acl/test.n3',
exists: false,
patch: `<> a solid:InsertDeletePatch;
Expand All @@ -141,6 +141,16 @@ describe('PATCH through text/n3', () => {
text: 'contained reserved suffixes in path'
}))

describe('on an N3 file that has an invalid uri (*.meta)', describePatch({
path: '/foo/bar/xyz.meta/test.n3',
exists: false,
patch: `<> a solid:InsertDeletePatch;
solid:insers { <x> <y> <z>. }.`
}, {
status: 400,
text: 'contained reserved suffixes in path'
}))

describe('on a resource with read-only access', describePatch({
path: '/read-only.ttl',
patch: `<> a solid:InsertDeletePatch;
Expand Down

0 comments on commit e4bb2e9

Please sign in to comment.