mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
This fixes a case with i18n in pages router with deeply nested mixed `fallback: false` and `fallback: 'blocking'` routes where the internal `NoFallbackError` would be bubbled outside of the server handler causing the invariant to leak instead of rendering the 404 page like expected. Verified against our E2E deploy tests here https://github.com/vercel/vercel/actions/runs/16586881087/job/46913897238 and https://github.com/vercel/next.js/actions/runs/16586877291/job/46913935296 Closes: NEXT-4655
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('i18n-disallow-multiple-locales', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it.each([
|
|
['/non-existent'],
|
|
['/es/non-existent'],
|
|
['/first/non-existent'],
|
|
['/es/first/non-existent'],
|
|
['/first/second/non-existent'],
|
|
['/es/first/second/non-existent'],
|
|
])(
|
|
'should 404 properly for fallback: false non-prerendered %s',
|
|
async (pathname) => {
|
|
const res = await next.fetch(pathname)
|
|
expect(res.status).toBe(404)
|
|
}
|
|
)
|
|
|
|
it.each([
|
|
{ urlPath: '/first', page: '/[first]' },
|
|
{ urlPath: '/first/second', page: '/[first]/[second]' },
|
|
{ urlPath: '/first/second/third', page: '/[first]/[second]/[third]' },
|
|
{
|
|
urlPath: '/first/second/third/fourth',
|
|
page: '/[first]/[second]/[third]/[fourth]',
|
|
},
|
|
])(
|
|
'should render properly for fallback: false prerendered $urlPath',
|
|
async ({ urlPath, page }) => {
|
|
const res = await next.fetch(urlPath)
|
|
expect(res.status).toBe(200)
|
|
expect(await res.text()).toContain(page)
|
|
}
|
|
)
|
|
|
|
it('should render properly for fallback: blocking', async () => {
|
|
const res = await next.fetch('/first/second/third/another')
|
|
expect(res.status).toBe(200)
|
|
expect(await res.text()).toContain('/[first]/[second]/[third]/[fourth]')
|
|
})
|
|
})
|