@@ -349,7 +349,7 @@ describe('node-static', function () {
349349 } ) ;
350350 } ) ;
351351
352- describe ( 'once an http server is listening with JSON files configuration' , function ( ) {
352+ describe ( 'once an http server is listening with missing JSON files configuration' , function ( ) {
353353 before ( function ( ) {
354354 fileServer = new statik . Server ( __dirname + '/../fixtures/index-without-json' ) ;
355355 } ) ;
@@ -366,6 +366,24 @@ describe('node-static', function () {
366366 } ) ;
367367 } ) ;
368368
369+ describe ( 'once an http server is listening with multiple JSON files configuration' , function ( ) {
370+ before ( function ( ) {
371+ fileServer = new statik . Server ( __dirname + '/../fixtures/index-with-json-files' ) ;
372+ } ) ;
373+ beforeEach ( async function ( ) {
374+ await setupStaticServer ( this ) ;
375+ } ) ;
376+ afterEach ( async function ( ) {
377+ this . server . close ( ) ;
378+ } ) ;
379+
380+ it ( 'returns 200 with missing JSON file' , async function ( ) {
381+ const response = await fetch ( this . getTestServer ( ) + '/' ) ;
382+ assert . equal ( response . status , 200 , 'should respond with 200' ) ;
383+ assert . equal ( await response . text ( ) , 'Hi\nhello world' , 'should respond with Hi\nhello world' ) ;
384+ } ) ;
385+ } ) ;
386+
369387 describe ( 'once an http server is listening with bad JSON files configuration' , function ( ) {
370388 before ( function ( ) {
371389 fileServer = new statik . Server ( __dirname + '/../fixtures/index-with-bad-json' ) ;
@@ -383,6 +401,23 @@ describe('node-static', function () {
383401 } ) ;
384402 } ) ;
385403
404+ describe ( 'once an http server is listening with malformed JSON files configuration' , function ( ) {
405+ before ( function ( ) {
406+ fileServer = new statik . Server ( __dirname + '/../fixtures/index-with-malformed-json-files' ) ;
407+ } ) ;
408+ beforeEach ( async function ( ) {
409+ await setupStaticServer ( this ) ;
410+ } ) ;
411+ afterEach ( async function ( ) {
412+ this . server . close ( ) ;
413+ } ) ;
414+
415+ it ( 'returns 404 with missing file from JSON file' , async function ( ) {
416+ const response = await fetch ( this . getTestServer ( ) + '/' ) ;
417+ assert . equal ( response . status , 404 , 'should respond with 404' ) ;
418+ } ) ;
419+ } ) ;
420+
386421 describe ( 'default extension' , function ( ) {
387422 beforeEach ( async function ( ) {
388423 await setupStaticServer ( this ) ;
0 commit comments