Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(test): fix external redirect link #9816

Merged
merged 2 commits into from Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/dev/basic.ssr.test.js
Expand Up @@ -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>')
})

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/basic.browser.test.js
Expand Up @@ -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()
})
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/redirect-external-no-slash.vue
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/redirect-external.vue
Expand Up @@ -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>