From 468881abda78521c77c6cc064b499fd12541c857 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Thu, 19 Apr 2018 00:06:22 +0800 Subject: [PATCH] misc: remove obsolete log spy --- test/unit/basic.dev.test.js | 4 ---- test/unit/error.test.js | 1 - test/unit/with-config.test.js | 44 ----------------------------------- 3 files changed, 49 deletions(-) diff --git a/test/unit/basic.dev.test.js b/test/unit/basic.dev.test.js index 89f6640ea1..4faf2703f2 100644 --- a/test/unit/basic.dev.test.js +++ b/test/unit/basic.dev.test.js @@ -31,12 +31,9 @@ describe('basic dev', () => { // }) test('/stateless', async () => { - // const spies = await intercept() const window = await nuxt.renderAndGetWindow(url('/stateless')) const html = window.document.body.innerHTML expect(html.includes('

My component!

')).toBe(true) - // expect(spies.info.calledWithMatch('You are running Vue in development mode.')).toBe(true) - // release() }) // test('/_nuxt/test.hot-update.json should returns empty html', async t => { @@ -73,7 +70,6 @@ describe('basic dev', () => { const sourceMaps = nuxt.renderer.resources.serverBundle.maps nuxt.renderer.resources.serverBundle.maps = {} - // const errorSpy = await interceptError() await expect(nuxt.renderAndGetWindow(url('/error'))).rejects.toMatchObject({ statusCode: 500 }) diff --git a/test/unit/error.test.js b/test/unit/error.test.js index d3a3bade54..3a92a3057f 100644 --- a/test/unit/error.test.js +++ b/test/unit/error.test.js @@ -28,7 +28,6 @@ describe('error', () => { }) test('/ with renderAndGetWindow()', async () => { - // const errorSpy = await interceptError() await expect(nuxt.renderAndGetWindow(url('/'))).rejects.toMatchObject({ statusCode: 500 }) diff --git a/test/unit/with-config.test.js b/test/unit/with-config.test.js index db7068dc84..22bf6fe7db 100644 --- a/test/unit/with-config.test.js +++ b/test/unit/with-config.test.js @@ -14,12 +14,8 @@ describe('with-config', () => { }) test('/', async () => { - // const logSpy = await interceptLog() const { html } = await nuxt.renderRoute('/') expect(html.includes('

I have custom configurations

')).toBe(true) - // release() - // expect(logSpy.calledOnce).toBe(true) - // expect(logSpy.args[0][0]).toBe('Test plugin!') }) test.skip('/ (global styles inlined)', async () => { @@ -61,12 +57,7 @@ describe('with-config', () => { }) test('/test/about (custom layout)', async () => { - // const logSpy = await interceptLog() const window = await nuxt.renderAndGetWindow(url('/test/about')) - // expect(logSpy.calledOnce).toBe(true) - // expect(logSpy.args[0][0]).toBe('Test plugin!') - // release() - const html = window.document.body.innerHTML expect(window.__NUXT__.layout).toBe('custom') expect(html.includes('

Custom layout

')).toBe(true) @@ -74,12 +65,7 @@ describe('with-config', () => { }) test('/test/desktop (custom layout in desktop folder)', async () => { - // const logSpy = await interceptLog() const window = await nuxt.renderAndGetWindow(url('/test/desktop')) - // expect(logSpy.calledOnce).toBe(true) - // expect(logSpy.args[0][0]).toBe('Test plugin!') - // release() - const html = window.document.body.innerHTML expect(window.__NUXT__.layout).toBe('desktop/default') expect(html.includes('

Default desktop layout

')).toBe(true) @@ -87,12 +73,7 @@ describe('with-config', () => { }) test('/test/mobile (custom layout in mobile folder)', async () => { - // const logSpy = await interceptLog() const window = await nuxt.renderAndGetWindow(url('/test/mobile')) - // expect(logSpy.calledOnce).toBe(true) - // expect(logSpy.args[0][0]).toBe('Test plugin!') - // release() - const html = window.document.body.innerHTML expect(window.__NUXT__.layout).toBe('mobile/default') expect(html.includes('

Default mobile layout

')).toBe(true) @@ -100,12 +81,7 @@ describe('with-config', () => { }) test('/test/env', async () => { - // const logSpy = await interceptLog() const window = await nuxt.renderAndGetWindow(url('/test/env')) - // expect(logSpy.calledOnce).toBe(true) - // expect(logSpy.args[0][0]).toBe('Test plugin!') - // release() - const html = window.document.body.innerHTML expect(html.includes('

Custom env layout

')).toBe(true) expect(html.includes('"bool": true')).toBe(true) @@ -118,46 +94,26 @@ describe('with-config', () => { }) test('/test/error', async () => { - // const logSpy = await interceptLog() const window = await nuxt.renderAndGetWindow(url('/test/error')) - // expect(logSpy.calledOnce).toBe(true) - // expect(logSpy.args[0][0]).toBe('Test plugin!') - // release() - const html = window.document.body.innerHTML expect(html.includes('Error page')).toBe(true) }) test('/test/user-agent', async () => { - // const logSpy = await interceptLog() const window = await nuxt.renderAndGetWindow(url('/test/user-agent')) - // expect(logSpy.calledOnce).toBe(true) - // expect(logSpy.args[0][0]).toBe('Test plugin!') - // release() - const html = window.document.body.innerHTML expect(html.includes('
Mozilla')).toBe(true)
   })
 
   test('/test/about-bis (added with extendRoutes)', async () => {
-    // const logSpy = await interceptLog()
     const window = await nuxt.renderAndGetWindow(url('/test/about-bis'))
-    // expect(logSpy.calledOnce).toBe(true)
-    // expect(logSpy.args[0][0]).toBe('Test plugin!')
-    // release()
-
     const html = window.document.body.innerHTML
     expect(html.includes('

Custom layout

')).toBe(true) expect(html.includes('

About page

')).toBe(true) }) test('/test/redirect/about-bis (redirect with extendRoutes)', async () => { - // const logSpy = await interceptLog() const window = await nuxt.renderAndGetWindow(url('/test/redirect/about-bis')) - // expect(logSpy.calledOnce).toBe(true) - // expect(logSpy.args[0][0]).toBe('Test plugin!') - // release() - const windowHref = window.location.href expect(windowHref.includes('/test/about-bis')).toBe(true)