Skip to content

Commit 1d90cc5

Browse files
committed
test: 404s
1 parent fca649e commit 1d90cc5

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

test/integration/binary.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,25 @@ 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 404', async function () {
76+
const {response /* , stdout */} = await spawnConditional(binFile, [
77+
'-p', this.port, fixturePath
78+
], timeout - 9000, {
79+
condition: /serving ".*?"/,
80+
action: (/* err, stdout */) => {
81+
return fetch(
82+
`http://localhost:${this.port}/bad-file`
83+
);
84+
}
85+
});
86+
87+
const {status} = response;
88+
const text = await response.text();
89+
90+
assert.equal(status, 404, 'should respond with 404');
91+
assert.equal(text, 'Not Found', 'should respond with Not Found');
92+
});
93+
7594
it('serving file within directory and indexFile', async function () {
7695
const {response /* , stdout */} = await spawnConditional(binFile, [
7796
'-p', this.port, fixturePath, '--index-file', 'hello.txt'

0 commit comments

Comments
 (0)