-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate to
@nuxt/test-utils
(#96)
- Loading branch information
Showing
5 changed files
with
375 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,19 @@ | ||
import { join } from 'path' | ||
import { setup, get } from '@nuxtjs/module-test-utils' | ||
import colorModeModule from '../' | ||
import { setupTest, get } from '@nuxt/test-utils' | ||
|
||
describe('module', () => { | ||
let nuxt | ||
const rootDir = join(__dirname, '..', 'example') | ||
|
||
beforeAll(async () => { | ||
const rootDir = join(__dirname, '..', 'example') | ||
|
||
const config = { | ||
ssr: false, | ||
rootDir, | ||
modules: [ | ||
'@nuxtjs/svg', | ||
colorModeModule | ||
] | ||
setupTest({ | ||
server: true, | ||
rootDir, | ||
config: { | ||
ssr: false | ||
} | ||
|
||
nuxt = (await setup(config)).nuxt | ||
}, 60000) | ||
|
||
afterAll(async () => { | ||
await nuxt.close() | ||
}) | ||
|
||
test('render', async () => { | ||
const html = await get('/') | ||
expect(html).toContain('nuxt-color-mode') | ||
const { body } = await get('/') | ||
expect(body).toContain('nuxt-color-mode') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,16 @@ | ||
import { join } from 'path' | ||
import { setup, get } from '@nuxtjs/module-test-utils' | ||
import colorModeModule from '../' | ||
import { setupTest, get } from '@nuxt/test-utils' | ||
|
||
describe('module', () => { | ||
let nuxt | ||
const rootDir = join(__dirname, '..', 'example') | ||
|
||
beforeAll(async () => { | ||
const rootDir = join(__dirname, '..', 'example') | ||
|
||
const config = { | ||
rootDir, | ||
modules: [ | ||
'@nuxtjs/svg', | ||
colorModeModule | ||
] | ||
} | ||
|
||
nuxt = (await setup(config)).nuxt | ||
}, 60000) | ||
|
||
afterAll(async () => { | ||
await nuxt.close() | ||
setupTest({ | ||
server: true, | ||
rootDir | ||
}) | ||
|
||
test('render', async () => { | ||
const html = await get('/') | ||
expect(html).toContain('@nuxtjs/color-mode') | ||
const { body } = await get('/') | ||
expect(body).toContain('@nuxtjs/color-mode') | ||
}) | ||
}) |
Oops, something went wrong.