@@ -72,6 +72,27 @@ describe('node-static (CLI)', function () {
7272 assert . equal ( cacheControl , 'max-age=3600' , 'should respond with cache-control' ) ;
7373 } ) ;
7474
75+ it ( 'serving file within directory and indexFile' , async function ( ) {
76+ const { response /* , stdout */ } = await spawnConditional ( binFile , [
77+ '-p' , this . port , fixturePath , '--index-file' , 'hello.txt'
78+ ] , timeout - 9000 , {
79+ condition : / s e r v i n g " .* ?" / ,
80+ action : ( /* err, stdout */ ) => {
81+ return fetch (
82+ `http://localhost:${ this . port } /`
83+ ) ;
84+ }
85+ } ) ;
86+
87+ const { status} = response ;
88+ const contentType = response . headers . get ( 'content-type' ) ;
89+ const text = await response . text ( ) ;
90+
91+ assert . equal ( status , 200 , 'should respond with 200' ) ;
92+ assert . equal ( contentType , 'text/plain' , 'should respond with text/plain' ) ;
93+ assert . equal ( text , 'hello world' , 'should respond with hello world' ) ;
94+ } ) ;
95+
7596 it ( 'serving file within directory with headers' , async function ( ) {
7697 const { response /* , stdout */ } = await spawnConditional ( binFile , [
7798 '-p' , this . port ,
0 commit comments