From 858358d3a5bbd68f4fbb826447c8976a03433b36 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Wed, 30 Mar 2022 12:01:31 -0500 Subject: [PATCH] add static 404 with react 18 test --- test/production/react-18-streaming-ssr/index.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/production/react-18-streaming-ssr/index.test.ts b/test/production/react-18-streaming-ssr/index.test.ts index 93a9a873051f..a1a5e01529f0 100644 --- a/test/production/react-18-streaming-ssr/index.test.ts +++ b/test/production/react-18-streaming-ssr/index.test.ts @@ -38,6 +38,14 @@ describe('react 18 streaming SSR in minimal mode', () => { const html = await renderViaHTTP(next.url, '/') expect(html).toContain('static streaming') }) + + it('should have generated a static 404 page', async () => { + expect(await next.readFile('.next/server/pages/404.html')).toBeTruthy() + + const res = await fetchViaHTTP(next.url, '/non-existent') + expect(res.status).toBe(404) + expect(await res.text()).toContain('This page could not be found') + }) }) describe('react 18 streaming SSR with custom next configs', () => {