misc(test): json format error

This commit is contained in:
Clark Du 2018-04-16 00:40:42 +08:00
parent b7d54b2c75
commit 0aea0d532c
No known key found for this signature in database
GPG Key ID: D0E5986AF78B86D9

View File

@ -159,6 +159,23 @@ describe('basic ssr', () => {
// expect(errorSpy.args[0][0].message.includes('Error mouahahah')).toBe(true)
})
test('/error json format error', async () => {
const opts = {
headers: {
accept: 'application/json'
},
resolveWithFullResponse: true
}
await expect(rp(url('/error'), opts)).rejects.toMatchObject({
statusCode: 500,
response: {
headers: {
'content-type': 'text/json; charset=utf-8'
}
}
})
})
test('/error2', async () => {
const { html, error } = await nuxt.renderRoute('/error2')
expect(html.includes('Custom error')).toBe(true)