From 33e482f2d0a3db25cf38f9918d3e0ad1a138be63 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Thu, 1 Feb 2024 18:46:55 +0100 Subject: fix(netlify): pre-rendered 404 pages aren't shown (#143) --- .../netlify/test/functions/cookies.test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'packages/integrations/netlify/test/functions/cookies.test.js') 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"); + }) }); -- cgit v1.2.3