mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
test: try to fix unhandled request
This commit is contained in:
parent
0b3796d45f
commit
2f2baacbcc
@ -56,6 +56,7 @@ export default async function renderAndGetWindow(
|
|||||||
if (!nuxtExists) {
|
if (!nuxtExists) {
|
||||||
const error = new Error('Could not load the nuxt app')
|
const error = new Error('Could not load the nuxt app')
|
||||||
error.body = window.document.body.innerHTML
|
error.body = window.document.body.innerHTML
|
||||||
|
window.close()
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,10 +107,9 @@ describe('basic dev', () => {
|
|||||||
const window = await nuxt.server.renderAndGetWindow(url('/stateless'))
|
const window = await nuxt.server.renderAndGetWindow(url('/stateless'))
|
||||||
const html = window.document.body.innerHTML
|
const html = window.document.body.innerHTML
|
||||||
expect(html).toContain('<h1>My component!</h1>')
|
expect(html).toContain('<h1>My component!</h1>')
|
||||||
})
|
// Check render:routeDone hook called
|
||||||
|
|
||||||
test('Check render:routeDone hook called', () => {
|
|
||||||
expect(nuxt.__hook_render_routeDone__).toBe('/stateless')
|
expect(nuxt.__hook_render_routeDone__).toBe('/stateless')
|
||||||
|
window.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
// test('/_nuxt/test.hot-update.json should returns empty html', async t => {
|
// test('/_nuxt/test.hot-update.json should returns empty html', async t => {
|
||||||
@ -122,7 +121,7 @@ describe('basic dev', () => {
|
|||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
|
|
||||||
test.skip('/__open-in-editor (open-in-editor)', async () => {
|
test('/__open-in-editor (open-in-editor)', async () => {
|
||||||
const { body } = await rp(
|
const { body } = await rp(
|
||||||
url('/__open-in-editor?file=pages/index.vue'),
|
url('/__open-in-editor?file=pages/index.vue'),
|
||||||
{ resolveWithFullResponse: true }
|
{ resolveWithFullResponse: true }
|
||||||
@ -130,7 +129,7 @@ describe('basic dev', () => {
|
|||||||
expect(body).toBe('')
|
expect(body).toBe('')
|
||||||
})
|
})
|
||||||
|
|
||||||
test.skip('/__open-in-editor should return error (open-in-editor)', async () => {
|
test('/__open-in-editor should return error (open-in-editor)', async () => {
|
||||||
await expect(rp(url('/__open-in-editor?file='))).rejects.toMatchObject({
|
await expect(rp(url('/__open-in-editor?file='))).rejects.toMatchObject({
|
||||||
statusCode: 500,
|
statusCode: 500,
|
||||||
error: 'launch-editor-middleware: required query param "file" is missing.'
|
error: 'launch-editor-middleware: required query param "file" is missing.'
|
||||||
@ -143,7 +142,7 @@ describe('basic dev', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test.skip('/error should return json format error (Youch)', async () => {
|
test('/error should return json format error (Youch)', async () => {
|
||||||
const opts = {
|
const opts = {
|
||||||
headers: {
|
headers: {
|
||||||
accept: 'application/json'
|
accept: 'application/json'
|
||||||
|
Loading…
Reference in New Issue
Block a user