diff --git a/test/tests/server.js b/test/tests/server.js index 0babd86f4..5a94344ab 100644 --- a/test/tests/server.js +++ b/test/tests/server.js @@ -51,6 +51,14 @@ describe('Server', () => { listen = listenShorthand(done); // Hack to add a mock HMR json file to the in-memory filesystem. instance.fileSystem.writeFileSync('/123a123412.hot-update.json', '["hi"]'); + + // Add a nested directory and index.html inside + instance.fileSystem.mkdirSync('/reference'); + instance.fileSystem.mkdirSync('/reference/mono-v6.x.x'); + instance.fileSystem.writeFileSync( + '/reference/mono-v6.x.x/index.html', + 'My Index.' + ); }); after(close); @@ -103,6 +111,14 @@ describe('Server', () => { .expect(200, /My Index\./, done); }); + it('request to subdirectory without trailing slash', (done) => { + request(app) + .get('/public/reference/mono-v6.x.x') + .expect('Content-Type', 'text/html; charset=UTF-8') + .expect('Content-Length', '9') + .expect(200, /My Index\./, done); + }); + it('invalid range header', (done) => { request(app).get('/public/svg.svg') .set('Range', 'bytes=6000-') diff --git a/test/tests/util.js b/test/tests/util.js index 0a0b4f92b..476b4d83a 100644 --- a/test/tests/util.js +++ b/test/tests/util.js @@ -268,6 +268,12 @@ describe('GetFilenameFromUrl', () => { outputPath: '/test/#leadinghash', publicPath: '/', expected: '/test/#leadinghash/test/sample.txt' + }, + { + url: '/folder-name-with-dots/mono-v6.x.x', + outputPath: '/', + publicPath: '/', + expected: '/folder-name-with-dots/mono-v6.x.x' } ];