mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-24 06:35:10 +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()
|
||||
})
|
||||
|
||||
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 () => {
|
||||
const { status } = await fetch('/redirect-infinite', { redirect: 'manual' })
|
||||
expect(status).toEqual(500)
|
||||
|
@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user