mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-06 21:10:38 +00:00
add test to extendRoutes redirect
This commit is contained in:
parent
8cb4188aa0
commit
27e1423e24
4
test/fixtures/with-config/nuxt.config.js
vendored
4
test/fixtures/with-config/nuxt.config.js
vendored
@ -12,6 +12,10 @@ module.exports = {
|
||||
name: 'about-bis',
|
||||
path: '/about-bis',
|
||||
component: '~/pages/about.vue'
|
||||
},
|
||||
{
|
||||
path: '/redirect/about-bis',
|
||||
redirect: '/about-bis'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -171,6 +171,21 @@ test.serial('/test/about-bis (added with extendRoutes)', async t => {
|
||||
t.true(html.includes('<h1>About page</h1>'))
|
||||
})
|
||||
|
||||
test.serial('/test/redirect/about-bis (redirect with extendRoutes)', async t => {
|
||||
const logSpy = await interceptLog()
|
||||
const window = await nuxt.renderAndGetWindow(url('/test/redirect/about-bis'))
|
||||
t.true(logSpy.calledOnce)
|
||||
t.is(logSpy.args[0][0], 'Test plugin!')
|
||||
release()
|
||||
|
||||
const windowHref = window.location.href
|
||||
t.true(windowHref.includes('/test/about-bis'))
|
||||
|
||||
const html = window.document.body.innerHTML
|
||||
t.true(html.includes('<h1>Custom layout</h1>'))
|
||||
t.true(html.includes('<h1>About page</h1>'))
|
||||
})
|
||||
|
||||
test('Check stats.json generated by build.analyze', t => {
|
||||
const stats = require(resolve(
|
||||
__dirname,
|
||||
|
Loading…
Reference in New Issue
Block a user