mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15: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>'))
|
||||
})
|
||||
|
||||
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
|
||||
test.after('Closing server', t => {
|
||||
server.close()
|
||||
|
@ -100,10 +100,11 @@ test('/redirect -> check redirected source', async t => {
|
||||
})
|
||||
|
||||
test('/error', async t => {
|
||||
const { html, error } = await nuxt.renderRoute('/error')
|
||||
t.true(html.includes('Error mouahahah'))
|
||||
t.true(error.message.includes('Error mouahahah'))
|
||||
t.true(error.statusCode === 500)
|
||||
try {
|
||||
await nuxt.renderRoute('/error', { req: {}, res: {} })
|
||||
} catch (err) {
|
||||
t.true(err.message.includes('Error mouahahah'))
|
||||
}
|
||||
})
|
||||
|
||||
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>
|
||||
export default {
|
||||
asyncData () {
|
||||
asyncData ({ req }) {
|
||||
// Not for nuxt generate
|
||||
if (req) {
|
||||
throw new Error('Error mouahahah')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user