Nuxt/test/unit/custom-app-template.test.js
2018-10-31 00:12:53 +03:30

24 lines
640 B
JavaScript

import { getPort, loadFixture, Nuxt } from '../utils'
let port
let nuxt = null
describe('custom-app-template', () => {
beforeAll(async () => {
const options = await loadFixture('custom-app-template')
nuxt = new Nuxt(options)
port = await getPort()
await nuxt.server.listen(port, '0.0.0.0')
})
test('/', async () => {
const { html } = await nuxt.server.renderRoute('/')
expect(html.includes('<p>My Template</p>')).toBe(true)
expect(html.includes('<h1>Custom!</h1>')).toBe(true)
})
// Close server and ask nuxt to stop listening to file changes
afterAll(async () => {
await nuxt.close()
})
})