mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
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.
42 lines
1.0 KiB
TypeScript
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'],
|
|
})
|
|
})
|
|
})
|