chore(test): fix external redirect link (#9816)

Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
Xin Du (Clark) 2021-09-17 16:51:20 +01:00 committed by GitHub
parent dc64e4eb98
commit 816007b994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -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/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>')
})
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/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>')
})

View File

@ -262,7 +262,7 @@ describe('basic browser', () => {
await page.nuxt.navigate('/redirect-external', false)
await page.waitForFunction(
() => window.location.href === 'https://nuxtjs.org/docs/2.x/features/data-fetching/'
() => window.location.href === 'https://example.com/test/'
)
page.close()
})

View File

@ -5,7 +5,7 @@
<script>
export default {
middleware ({ redirect }) {
return redirect('https://nuxtjs.org/docs/2.x/features/data-fetching')
return redirect('https://example.com/test')
}
}
</script>

View File

@ -5,7 +5,7 @@
<script>
export default {
middleware ({ redirect }) {
return redirect('https://nuxtjs.org/docs/2.x/features/data-fetching/')
return redirect('https://example.com/test/')
}
}
</script>