mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
chore(test): fix external redirect link (#9816)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
parent
dc64e4eb98
commit
816007b994
@ -182,14 +182,14 @@ describe('basic ssr', () => {
|
|||||||
test('/redirect -> external link', async () => {
|
test('/redirect -> external link', async () => {
|
||||||
const { html } = await nuxt.server.renderRoute('/redirect-external', renderContext)
|
const { html } = await nuxt.server.renderRoute('/redirect-external', renderContext)
|
||||||
expect(_status).toBe(302)
|
expect(_status).toBe(302)
|
||||||
expect(_headers.Location).toBe('https://nuxtjs.org/docs/2.x/features/data-fetching/')
|
expect(_headers.Location).toBe('https://example.com/test/')
|
||||||
expect(html).toContain('<div data-server-rendered="true" id="__nuxt"></div>')
|
expect(html).toContain('<div data-server-rendered="true" id="__nuxt"></div>')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('/redirect -> external link without trailing slash', async () => {
|
test('/redirect -> external link without trailing slash', async () => {
|
||||||
const { html } = await nuxt.server.renderRoute('/redirect-external-no-slash', renderContext)
|
const { html } = await nuxt.server.renderRoute('/redirect-external-no-slash', renderContext)
|
||||||
expect(_status).toBe(302)
|
expect(_status).toBe(302)
|
||||||
expect(_headers.Location).toBe('https://nuxtjs.org/docs/2.x/features/data-fetching')
|
expect(_headers.Location).toBe('https://example.com/test')
|
||||||
expect(html).toContain('<div data-server-rendered="true" id="__nuxt"></div>')
|
expect(html).toContain('<div data-server-rendered="true" id="__nuxt"></div>')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ describe('basic browser', () => {
|
|||||||
await page.nuxt.navigate('/redirect-external', false)
|
await page.nuxt.navigate('/redirect-external', false)
|
||||||
|
|
||||||
await page.waitForFunction(
|
await page.waitForFunction(
|
||||||
() => window.location.href === 'https://nuxtjs.org/docs/2.x/features/data-fetching/'
|
() => window.location.href === 'https://example.com/test/'
|
||||||
)
|
)
|
||||||
page.close()
|
page.close()
|
||||||
})
|
})
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
middleware ({ redirect }) {
|
middleware ({ redirect }) {
|
||||||
return redirect('https://nuxtjs.org/docs/2.x/features/data-fetching')
|
return redirect('https://example.com/test')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
middleware ({ redirect }) {
|
middleware ({ redirect }) {
|
||||||
return redirect('https://nuxtjs.org/docs/2.x/features/data-fetching/')
|
return redirect('https://example.com/test/')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user