mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 13:15:12 +00:00
test: add tests to check 404 handling in client-side rendering
This commit is contained in:
parent
e644960794
commit
e068e6dbce
@ -249,6 +249,16 @@ describe('pages', () => {
|
|||||||
await serverPage.close()
|
await serverPage.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should render 404 page even in spa mode', async () => {
|
||||||
|
const { page } = await renderPage('/route-rules/spa')
|
||||||
|
|
||||||
|
await page.getByText('should throw a 404 error').click()
|
||||||
|
expect(await page.getByRole('heading').textContent()).toMatchInlineSnapshot(`"Page Not Found: /forbidden"`)
|
||||||
|
expect(await page.getByTestId('path').textContent()).toMatchInlineSnapshot(`" Path: /forbidden"`)
|
||||||
|
|
||||||
|
await page.close()
|
||||||
|
})
|
||||||
|
|
||||||
it('returns 500 when there is an infinite redirect', async () => {
|
it('returns 500 when there is an infinite redirect', async () => {
|
||||||
const { status } = await fetch('/redirect-infinite', { redirect: 'manual' })
|
const { status } = await fetch('/redirect-infinite', { redirect: 'manual' })
|
||||||
expect(status).toEqual(500)
|
expect(status).toEqual(500)
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
should not be rendered on ssr
|
<div>
|
||||||
|
should not be rendered on ssr
|
||||||
|
</div>
|
||||||
|
<NuxtLink to="/forbidden">
|
||||||
|
should throw a 404 error
|
||||||
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user