From 0aea0d532c5dd6f5a676d9b0ee4b88e53b405e35 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Mon, 16 Apr 2018 00:40:42 +0800 Subject: [PATCH] misc(test): json format error --- test/unit/basic.ssr.test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/unit/basic.ssr.test.js b/test/unit/basic.ssr.test.js index 39479ed4a1..52e2fd9313 100644 --- a/test/unit/basic.ssr.test.js +++ b/test/unit/basic.ssr.test.js @@ -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)