mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 18:13:54 +00:00
432720b8c8
* fix: appveyor test failure * ci: bring back yarn cache * ci: turn off matrix * refactor: use babel instead of esm in jest * refactor: use es modules in fixtures
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
import { loadFixture, getPort, Nuxt, rp } from '../utils'
|
|
|
|
let port
|
|
const url = route => 'http://localhost:' + port + route
|
|
|
|
let nuxt = null
|
|
|
|
describe('custom-dirs', () => {
|
|
beforeAll(async () => {
|
|
const config = await loadFixture('custom-dirs')
|
|
nuxt = new Nuxt(config)
|
|
port = await getPort()
|
|
await nuxt.listen(port, 'localhost')
|
|
})
|
|
|
|
test.skip('custom assets directory', async () => {
|
|
const { html } = await nuxt.renderRoute('/')
|
|
expect(html).toContain('.global-css-selector')
|
|
})
|
|
|
|
test('custom layouts directory', async () => {
|
|
const { html } = await nuxt.renderRoute('/')
|
|
expect(html.includes('<p>I have custom layouts directory</p>')).toBe(true)
|
|
})
|
|
|
|
test('custom middleware directory', async () => {
|
|
const window = await nuxt.renderAndGetWindow(url('/user-agent'))
|
|
const html = window.document.body.innerHTML
|
|
expect(html.includes('<pre>Mozilla')).toBe(true)
|
|
})
|
|
|
|
test('custom pages directory', async () => {
|
|
const { html } = await nuxt.renderRoute('/')
|
|
expect(html.includes('<h1>I have custom pages directory</h1>')).toBe(true)
|
|
})
|
|
|
|
test('custom static directory', async () => {
|
|
const { headers } = await rp(url('/test.txt'), {
|
|
resolveWithFullResponse: true
|
|
})
|
|
expect(headers['cache-control']).toBe('public, max-age=0')
|
|
})
|
|
|
|
// Close server and ask nuxt to stop listening to file changes
|
|
afterAll(async () => {
|
|
await nuxt.close()
|
|
})
|
|
})
|