diff options
author | 2024-02-01 18:46:55 +0100 | |
---|---|---|
committer | 2024-02-01 18:46:55 +0100 | |
commit | 33e482f2d0a3db25cf38f9918d3e0ad1a138be63 (patch) | |
tree | 9f145e13fc97182faf7741514b3985d49c335599 /packages/integrations/netlify/test/functions/cookies.test.js | |
parent | 63dea241d0d9df370a1a1fe7fddcdce58c86c715 (diff) | |
download | astro-33e482f2d0a3db25cf38f9918d3e0ad1a138be63.tar.gz astro-33e482f2d0a3db25cf38f9918d3e0ad1a138be63.tar.zst astro-33e482f2d0a3db25cf38f9918d3e0ad1a138be63.zip |
fix(netlify): pre-rendered 404 pages aren't shown (#143)
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"); + }) }); |