mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
test: fix redirect tests (#8282)
This commit is contained in:
parent
baf94d31f3
commit
011b3b4491
@ -182,14 +182,14 @@ describe('basic ssr', () => {
|
||||
test('/redirect -> external link', async () => {
|
||||
const { html } = await nuxt.server.renderRoute('/redirect-external', renderContext)
|
||||
expect(_status).toBe(302)
|
||||
expect(_headers.Location).toBe('https://nuxtjs.org/api/')
|
||||
expect(_headers.Location).toBe('https://nuxtjs.org/docs/2.x/features/data-fetching/')
|
||||
expect(html).toContain('<div data-server-rendered="true"></div>')
|
||||
})
|
||||
|
||||
test('/redirect -> external link without trailing slash', async () => {
|
||||
const { html } = await nuxt.server.renderRoute('/redirect-external-no-slash', renderContext)
|
||||
expect(_status).toBe(302)
|
||||
expect(_headers.Location).toBe('https://nuxtjs.org/api')
|
||||
expect(_headers.Location).toBe('https://nuxtjs.org/docs/2.x/features/data-fetching')
|
||||
expect(html).toContain('<div data-server-rendered="true"></div>')
|
||||
})
|
||||
|
||||
|
@ -261,7 +261,7 @@ describe('basic browser', () => {
|
||||
await page.nuxt.navigate('/redirect-external', false)
|
||||
|
||||
await page.waitForFunction(
|
||||
() => window.location.href === 'https://nuxtjs.org/api/'
|
||||
() => window.location.href === 'https://nuxtjs.org/docs/2.x/features/data-fetching/'
|
||||
)
|
||||
page.close()
|
||||
})
|
||||
|
@ -5,7 +5,7 @@
|
||||
<script>
|
||||
export default {
|
||||
middleware ({ redirect }) {
|
||||
return redirect('https://nuxtjs.org/api')
|
||||
return redirect('https://nuxtjs.org/docs/2.x/features/data-fetching')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<script>
|
||||
export default {
|
||||
middleware ({ redirect }) {
|
||||
return redirect('https://nuxtjs.org/api/')
|
||||
return redirect('https://nuxtjs.org/docs/2.x/features/data-fetching/')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user