Files
next.js/test/e2e/app-dir/rewrite-with-search-params/rewrite-with-search-params.test.ts
JJ KasperandGitHub da6fb315d5 Cleanup non-generic assertions in our deploy test suite (#90894)
This makes sure we don't have assertions that will only pass in one
environment e.g. these should work for running against bun and not just
node or against a local metadata URL not just a deployed https fully
qualified domain. Ensures others can leverage this test suite for their
own verification easily.
2026-03-04 15:59:07 -08:00

42 lines
1.0 KiB
TypeScript

import { nextTestSetup } from 'e2e-utils'
describe('rewrite-with-search-params', () => {
const { next, isNextDeploy } = nextTestSetup({
files: __dirname,
})
it('should not contain params in search params after rewrite', async () => {
const deploymentHost = isNextDeploy ? new URL(next.url).hostname : null
const shouldForceHostHeader =
!isNextDeploy ||
deploymentHost === 'localhost' ||
deploymentHost === '127.0.0.1'
const $ = await next.render$(
'/galleries/123',
{
param: 'value',
},
{
headers: shouldForceHostHeader
? {
host: 'vercel-test.vercel.app',
}
: undefined,
}
)
const searchParams = JSON.parse($('#search-params-value').text())
const params = JSON.parse($('#params-value').text())
expect(searchParams).toEqual({
param: 'value',
})
expect(params).toEqual({
domain: expect.stringMatching(/[\w-]+/),
section: ['galleries', '123'],
})
})
})