diff --git a/tests/core/app.test.ts b/tests/core/app.test.ts index dd7fffe1..d7a2d230 100644 --- a/tests/core/app.test.ts +++ b/tests/core/app.test.ts @@ -162,6 +162,13 @@ describe('Testing App routing', () => { await makeFetch(app.listen())('/abc').expect(200, 'Hello World') }) + it('should ignore a non-string, non-array base path and mount at root', async () => { + const app = new App() + + app.use(123 as unknown as string, (_req, res) => void res.send('Hello world')) + + await makeFetch(app.listen())('/').expect(200, 'Hello world') + }) it('should can set url prefix for the application', async () => { const app = new App() diff --git a/tests/core/request.test.ts b/tests/core/request.test.ts index 04d5f5ef..df564acd 100644 --- a/tests/core/request.test.ts +++ b/tests/core/request.test.ts @@ -794,4 +794,11 @@ describe('Request properties', () => { await fetch('/', { headers: { 'If-None-Match': etag, 'Cache-Control': 'max-age=3600' } }).expectStatus(304) }) + it('req.stale is true when the response is not fresh', async () => { + const { fetch } = InitAppAndTest((req, res) => { + res.send(`stale: ${req.stale}`) + }) + + await fetch('/').expect(200, 'stale: true') + }) }) diff --git a/tests/modules/negotiator.test.ts b/tests/modules/negotiator.test.ts index 66d7b556..9a4ff436 100644 --- a/tests/modules/negotiator.test.ts +++ b/tests/modules/negotiator.test.ts @@ -282,6 +282,16 @@ describe('Negotiator', () => { const negotiator = new Negotiator(createRequest({ accept: 'text/html;level' })) expect(negotiator.mediaTypes()).toEqual(['text/html']) }) + + it('should match when accept parameter has an empty value', () => { + const negotiator = new Negotiator(createRequest({ accept: 'text/html;level=' })) + expect(negotiator.mediaTypes(['text/html;level='])).toEqual(['text/html;level=']) + }) + + it('should not match when accept parameter has an empty value but provided does not', () => { + const negotiator = new Negotiator(createRequest({ accept: 'text/html;level=' })) + expect(negotiator.mediaTypes(['text/html;level=1'])).toEqual([]) + }) }) describe('edge cases', () => {