mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
Fix tests
This commit is contained in:
parent
ee6db19c8d
commit
b49cf4d9d5
@ -116,12 +116,6 @@ test('/redirect -> check redirected source', async t => {
|
|||||||
t.true(html.includes('<h1>Index page</h1>'))
|
t.true(html.includes('<h1>Index page</h1>'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('/error', async t => {
|
|
||||||
const window = await nuxt.renderAndGetWindow(url('/error'))
|
|
||||||
const html = window.document.body.innerHTML
|
|
||||||
t.true(html.includes('Error mouahahah'))
|
|
||||||
})
|
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test.after('Closing server', t => {
|
test.after('Closing server', t => {
|
||||||
server.close()
|
server.close()
|
||||||
|
@ -100,10 +100,11 @@ test('/redirect -> check redirected source', async t => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('/error', async t => {
|
test('/error', async t => {
|
||||||
const { html, error } = await nuxt.renderRoute('/error')
|
try {
|
||||||
t.true(html.includes('Error mouahahah'))
|
await nuxt.renderRoute('/error', { req: {}, res: {} })
|
||||||
t.true(error.message.includes('Error mouahahah'))
|
} catch (err) {
|
||||||
t.true(error.statusCode === 500)
|
t.true(err.message.includes('Error mouahahah'))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
test('/error status code', async t => {
|
test('/error status code', async t => {
|
||||||
|
5
test/fixtures/basic/pages/error.vue
vendored
5
test/fixtures/basic/pages/error.vue
vendored
@ -4,8 +4,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
asyncData () {
|
asyncData ({ req }) {
|
||||||
|
// Not for nuxt generate
|
||||||
|
if (req) {
|
||||||
throw new Error('Error mouahahah')
|
throw new Error('Error mouahahah')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user