diff options
Diffstat (limited to 'packages/integrations/netlify/test/functions/cookies.test.js')
-rw-r--r-- | packages/integrations/netlify/test/functions/cookies.test.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/integrations/netlify/test/functions/cookies.test.js b/packages/integrations/netlify/test/functions/cookies.test.js index ea8df7980..56a414d17 100644 --- a/packages/integrations/netlify/test/functions/cookies.test.js +++ b/packages/integrations/netlify/test/functions/cookies.test.js @@ -23,4 +23,24 @@ describe('Cookies', () => { expect(resp.headers.get('location')).to.equal('/'); expect(resp.headers.getSetCookie()).to.eql(['foo=foo; HttpOnly', 'bar=bar; HttpOnly']); }); + + it("renders dynamic 404 page", async () => { + const entryURL = new URL( + './fixtures/cookies/.netlify/functions-internal/ssr/ssr.mjs', + import.meta.url + ); + const { default: handler } = await import(entryURL); + const resp = await handler( + new Request('http://example.com/nonexistant-page', { + headers: { + "x-test": "bar" + } + }), + {} + ); + expect(resp.status).to.equal(404); + const text = await resp.text() + expect(text).to.contain("This is my custom 404 page"); + expect(text).to.contain("x-test: bar"); + }) }); |