@@ -82,26 +82,38 @@ describe('HTTP APIs', function() {
8282 . end ( done ) ;
8383 } ) ;
8484
85- it ( 'should have Access-Control-Allow-Origin on OPTIONS ' , function ( done ) {
85+ it ( 'should have Access-Control-Allow-Origin' , function ( done ) {
8686 server . options ( '/sampleContainer/example1.ttl' )
8787 . set ( 'Origin' , 'http://example.com' )
8888 . expect ( 'Access-Control-Allow-Origin' , 'http://example.com' )
8989 . end ( done ) ;
9090 } ) ;
9191
92- it ( 'should have set Link as resource in OPTIONS ' , function ( done ) {
92+ it ( 'should have set Link as resource' , function ( done ) {
9393 server . options ( '/sampleContainer/example1.ttl' )
9494 . expect ( 'Link' , / < h t t p : \/ \/ w w w .w 3 .o r g \/ n s \/ l d p # R e s o u r c e > ; r e l = " t y p e " / )
9595 . end ( done ) ;
9696 } ) ;
9797
98- it ( 'should have set Link as Container/BasicContainer in OPTIONS ' , function ( done ) {
98+ it ( 'should have set Link as Container/BasicContainer' , function ( done ) {
9999 server . options ( '/sampleContainer/' )
100100 . set ( 'Origin' , 'http://example.com' )
101101 . expect ( 'Link' , / < h t t p : \/ \/ w w w .w 3 .o r g \/ n s \/ l d p # B a s i c C o n t a i n e r > ; r e l = " t y p e " / )
102102 . expect ( 'Link' , / < h t t p : \/ \/ w w w .w 3 .o r g \/ n s \/ l d p # C o n t a i n e r > ; r e l = " t y p e " / )
103103 . end ( done ) ;
104104 } ) ;
105+
106+ it ( 'should have set meta Link in' , function ( done ) {
107+ server . options ( '/sampleContainer/' )
108+ . expect ( hasHeader ( '\'describedBy\'' , address + '/sampleContainer/' + '.meta' ) )
109+ . end ( done ) ;
110+ } ) ;
111+
112+ it ( 'should have set acl Link in' , function ( done ) {
113+ server . options ( '/sampleContainer/' )
114+ . expect ( hasHeader ( '\'acl\'' , address + '/sampleContainer/' + '.acl' ) )
115+ . end ( done ) ;
116+ } ) ;
105117 } ) ;
106118
107119 describe ( 'GET API' , function ( ) {
@@ -131,29 +143,39 @@ describe('HTTP APIs', function() {
131143 . expect ( 'Link' , / < h t t p : \/ \/ w w w .w 3 .o r g \/ n s \/ l d p # C o n t a i n e r > ; r e l = " t y p e " / )
132144 . expect ( 200 , done ) ;
133145 } ) ;
134- it ( 'Should return 404 for non-existent resource' , function ( done ) {
146+ it ( 'should return 404 for non-existent resource' , function ( done ) {
135147 server . get ( '/invalidfile.foo' )
136148 . expect ( 404 , done ) ;
137149 } ) ;
138- it ( 'Should return basic container link for directories' , function ( done ) {
150+ it ( 'should return basic container link for directories' , function ( done ) {
139151 server . get ( '/' )
140152 . expect ( 'Link' , / h t t p : \/ \/ w w w .w 3 .o r g \/ n s \/ l d p # B a s i c C o n t a i n e r / )
141153 . expect ( 200 , done ) ;
142154 } ) ;
143- it ( 'Should return resource link for files' , function ( done ) {
155+ it ( 'should return resource link for files' , function ( done ) {
144156 server . get ( '/hello.html' )
145157 . expect ( 'Link' , / < h t t p : \/ \/ w w w .w 3 .o r g \/ n s \/ l d p # R e s o u r c e > ; r e l = " t y p e " / )
146158 . expect ( 200 , done ) ;
147159 } ) ;
148- it ( 'Should have glob support' , function ( done ) {
160+ it ( 'should have glob support' , function ( done ) {
149161 server . get ( '/sampleContainer/example*' )
150162 . expect ( 'content-type' , / t e x t \/ t u r t l e / )
151163 . expect ( 200 , done ) ;
152164 } ) ;
165+ it ( 'should have set meta Link' , function ( done ) {
166+ server . get ( '/sampleContainer/' )
167+ . expect ( hasHeader ( '\'describedBy\'' , address + '/sampleContainer/' + '.meta' ) )
168+ . end ( done ) ;
169+ } ) ;
170+
171+ it ( 'should have set acl Link' , function ( done ) {
172+ server . get ( '/sampleContainer/' )
173+ . expect ( hasHeader ( '\'acl\'' , address + '/sampleContainer/' + '.acl' ) )
174+ . end ( done ) ;
175+ } ) ;
153176 } ) ;
154177
155178 describe ( 'HEAD API' , function ( ) {
156-
157179 it ( 'should have Access-Control-Allow-Origin as Origin' , function ( done ) {
158180 server . head ( '/sampleContainer/example1.ttl' )
159181 . set ( 'Origin' , 'http://example.com' )
@@ -185,6 +207,7 @@ describe('HTTP APIs', function() {
185207 . expect ( hasHeader ( '\'describedBy\'' , address + '/' + '.meta' ) )
186208 . expect ( 200 , done ) ;
187209 } ) ;
210+
188211 it ( 'Should return acl header' , function ( done ) {
189212 server . head ( '/' )
190213 . expect ( hasHeader ( '\'acl\'' , address + '/' + '.acl' ) )
@@ -207,6 +230,8 @@ describe('HTTP APIs', function() {
207230 server . put ( '/foo/bar/baz.ttl' )
208231 . send ( putRequestBody )
209232 . set ( 'content-type' , 'text/turtle' )
233+ . expect ( hasHeader ( '\'describedBy\'' , address + '/sampleContainer/' + '.meta' ) )
234+ . expect ( hasHeader ( '\'acl\'' , address + '/sampleContainer/' + '.acl' ) )
210235 . expect ( function ( ) {
211236 fs . unlinkSync ( __dirname + '/resources/foo/bar/baz.ttl' ) ;
212237 fs . rmdirSync ( __dirname + '/resources/foo/bar/' ) ;
@@ -245,6 +270,8 @@ describe('HTTP APIs', function() {
245270 . set ( 'content-type' , 'text/turtle' )
246271 . set ( 'slug' , 'post-resource-1' )
247272 . expect ( 'location' , address + '/post-resource-1.ttl' )
273+ . expect ( hasHeader ( '\'describedBy\'' , address + '/post-resource-1.ttl' + '.meta' ) )
274+ . expect ( hasHeader ( '\'acl\'' , address + '/post-resource-1.ttl' + '.acl' ) )
248275 . expect ( 201 , done ) ;
249276 } ) ;
250277 it ( 'Should reject requests to existing resources' , function ( done ) {
0 commit comments