From 4c288330822408804c99dd36fdf7bd5730916e1e Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 15 Dec 2023 17:45:56 -0700 Subject: [PATCH] tests: added test case for ensuring search parameters are sent to the resume --- test/e2e/app-dir/ppr/app/search/page.jsx | 3 +++ test/e2e/app-dir/ppr/ppr.test.ts | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/e2e/app-dir/ppr/app/search/page.jsx diff --git a/test/e2e/app-dir/ppr/app/search/page.jsx b/test/e2e/app-dir/ppr/app/search/page.jsx new file mode 100644 index 0000000000000..606b144c7ef1a --- /dev/null +++ b/test/e2e/app-dir/ppr/app/search/page.jsx @@ -0,0 +1,3 @@ +export default function Page({ searchParams }) { + return searchParams.query ?? null +} diff --git a/test/e2e/app-dir/ppr/ppr.test.ts b/test/e2e/app-dir/ppr/ppr.test.ts index 15c40a107a34c..3add628e8292b 100644 --- a/test/e2e/app-dir/ppr/ppr.test.ts +++ b/test/e2e/app-dir/ppr/ppr.test.ts @@ -119,6 +119,19 @@ createNextDescribe( }) }) + describe('search parameters', () => { + it('should render the page with the search parameters', async () => { + const expected = `${Date.now()}:${Math.random()}` + const res = await next.fetch( + `/search?query=${encodeURIComponent(expected)}` + ) + expect(res.status).toBe(200) + + const html = await res.text() + expect(html).toContain(expected) + }) + }) + describe.each([{ pathname: '/no-suspense' }])( 'without suspense for $pathname', ({ pathname }) => {