@@ -9,9 +9,9 @@ import { assert, expect } from 'chai'
99const __filename = fileURLToPath ( import . meta. url )
1010const __dirname = path . dirname ( __filename )
1111
12- const suffixAcl = '.acl'
13- const suffixMeta = '.meta'
14- const server = setupSupertestServer ( {
12+ const suffixAcl = '.acl'
13+ const suffixMeta = '.meta'
14+ const server = setupSupertestServer ( {
1515 live : true ,
1616 dataBrowserPath : 'default' ,
1717 root : path . join ( __dirname , '../resources' ) ,
@@ -253,13 +253,20 @@ describe('HTTP APIs', function () {
253253 . expect ( 'content-type' , / t e x t \/ t u r t l e / )
254254 . expect ( 'Access-Control-Allow-Origin' , 'http://example.com' )
255255 . expect ( 200 , done )
256- } )
257- it ( 'should have set Link as resource' , function ( done ) {
258- server . get ( '/sampleContainer2/example1.ttl' )
259- . expect ( 'content-type' , / t e x t \/ t u r t l e / )
260- . 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 " / )
261- . expect ( 200 , done )
262- } )
256+ } )
257+ it ( 'should have set Link as resource' , function ( done ) {
258+ server . get ( '/sampleContainer2/example1.ttl' )
259+ . expect ( 'content-type' , / t e x t \/ t u r t l e / )
260+ . 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 " / )
261+ . expect ( 200 , done )
262+ } )
263+ it ( 'should have set Last-Modified for resource' , function ( done ) {
264+ const modified = fs . statSync ( path . join ( __dirname ,
265+ '../resources/sampleContainer2/example1.ttl' ) ) . mtime . toUTCString ( )
266+ server . get ( '/sampleContainer2/example1.ttl' )
267+ . expect ( 'Last-Modified' , modified )
268+ . expect ( 200 , done )
269+ } )
263270 it ( 'should have set Updates-Via to use WebSockets' , function ( done ) {
264271 server . get ( '/sampleContainer2/example1.ttl' )
265272 . expect ( 'updates-via' , / w s s ? : \/ \/ / )
@@ -273,13 +280,20 @@ describe('HTTP APIs', function () {
273280 . expect ( hasHeader ( 'describedBy' , 'example1.ttl' + suffixMeta ) )
274281 . end ( done )
275282 } )
276- it ( 'should have set Link as Container/BasicContainer' , function ( done ) {
277- server . get ( '/sampleContainer2/' )
278- . expect ( 'content-type' , / t e x t \/ t u r t l e / )
279- . 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 " / )
280- . 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 " / )
281- . expect ( 200 , done )
282- } )
283+ it ( 'should have set Link as Container/BasicContainer' , function ( done ) {
284+ server . get ( '/sampleContainer2/' )
285+ . expect ( 'content-type' , / t e x t \/ t u r t l e / )
286+ . 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 " / )
287+ . 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 " / )
288+ . expect ( 200 , done )
289+ } )
290+ it ( 'should have set Last-Modified for container' , function ( done ) {
291+ const modified = fs . statSync ( path . join ( __dirname ,
292+ '../resources/sampleContainer2' ) ) . mtime . toUTCString ( )
293+ server . get ( '/sampleContainer2/' )
294+ . expect ( 'Last-Modified' , modified )
295+ . expect ( 200 , done )
296+ } )
283297 it ( 'should load skin (mashlib) if resource was requested as text/html' , function ( done ) {
284298 server . get ( '/sampleContainer2/example1.ttl' )
285299 . set ( 'Accept' , 'text/html' )
@@ -505,11 +519,18 @@ describe('HTTP APIs', function () {
505519 . expect ( 'updates-via' , / w s s ? : \/ \/ / )
506520 . expect ( 200 , done )
507521 } )
508- it ( 'should have set Link as Resource' , function ( done ) {
509- server . head ( '/sampleContainer2/example1.ttl' )
510- . 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 " / )
511- . expect ( 200 , done )
512- } )
522+ it ( 'should have set Link as Resource' , function ( done ) {
523+ server . head ( '/sampleContainer2/example1.ttl' )
524+ . 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 " / )
525+ . expect ( 200 , done )
526+ } )
527+ it ( 'should have set Last-Modified for resource' , function ( done ) {
528+ const modified = fs . statSync ( path . join ( __dirname ,
529+ '../resources/sampleContainer2/example1.ttl' ) ) . mtime . toUTCString ( )
530+ server . head ( '/sampleContainer2/example1.ttl' )
531+ . expect ( 'Last-Modified' , modified )
532+ . expect ( 200 , done )
533+ } )
513534 it ( 'should have set acl and describedBy Links for resource' ,
514535 function ( done ) {
515536 server . head ( '/sampleContainer2/example1.ttl' )
@@ -523,13 +544,20 @@ describe('HTTP APIs', function () {
523544 . expect ( 'Content-Type' , / t e x t \/ t u r t l e / )
524545 . expect ( 200 , done )
525546 } )
526- it ( 'should have set Link as Container/BasicContainer' ,
527- function ( done ) {
528- server . head ( '/sampleContainer2/' )
529- . 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 " / )
530- . 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 " / )
531- . expect ( 200 , done )
532- } )
547+ it ( 'should have set Link as Container/BasicContainer' ,
548+ function ( done ) {
549+ server . head ( '/sampleContainer2/' )
550+ . 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 " / )
551+ . 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 " / )
552+ . expect ( 200 , done )
553+ } )
554+ it ( 'should have set Last-Modified for container' , function ( done ) {
555+ const modified = fs . statSync ( path . join ( __dirname ,
556+ '../resources/sampleContainer2' ) ) . mtime . toUTCString ( )
557+ server . head ( '/sampleContainer2/' )
558+ . expect ( 'Last-Modified' , modified )
559+ . expect ( 200 , done )
560+ } )
533561 it ( 'should have set acl and describedBy Links for container' ,
534562 function ( done ) {
535563 server . head ( '/sampleContainer2/' )
0 commit comments