mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-24 14:45:15 +00:00
b11e9c0e51
- [ ] babel-eslint https://github.com/babel/babel-eslint/issues/664 - [x] eslint-config-standard-jsx https://github.com/standard/eslint-config-standard-jsx/issues/32 - [x] eslint-config-standard to be stable release https://github.com/standard/eslint-config-standard/issues/123 - [x] eslint-plugin-html - [x] eslint-plugin-import - [x] eslint-plugin-jest - [x] eslint-plugin-node - [x] eslint-plugin-promise - [x] eslint-plugin-standard https://github.com/standard/eslint-plugin-standard/issues/29 - [x] eslint-plugin-vue https://github.com/vuejs/eslint-plugin-vue/pull/504 - [x] eslint-plugin-react https://github.com/yannickcr/eslint-plugin-react/releases/tag/v7.10.0
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import { loadFixture, getPort, Nuxt, rp } from '../utils'
|
|
|
|
let port
|
|
const url = route => 'http://localhost:' + port + route
|
|
|
|
let nuxt = null
|
|
|
|
describe('dist options', () => {
|
|
beforeAll(async () => {
|
|
const options = await loadFixture('basic')
|
|
nuxt = new Nuxt(Object.assign(options, { dev: false }))
|
|
port = await getPort()
|
|
await nuxt.listen(port, '0.0.0.0')
|
|
})
|
|
|
|
test('Specify maxAge/index in render.dist options', async () => {
|
|
const { body } = await rp(url('/'), {
|
|
resolveWithFullResponse: true
|
|
})
|
|
try {
|
|
await rp(url('/_nuxt/'), {
|
|
resolveWithFullResponse: true
|
|
})
|
|
} catch (err) {
|
|
expect(err.toString().includes('StatusCodeError'))
|
|
}
|
|
const distFile = body.match(/\/_nuxt\/.+?\.js/)[0]
|
|
const { headers } = await rp(url(distFile), {
|
|
resolveWithFullResponse: true
|
|
})
|
|
const twoYears = (((60 * 60 * 24 * 365) * 2) / 1000).toString()
|
|
expect(headers['cache-control'].includes(twoYears)).toBe(true)
|
|
})
|
|
|
|
// Close server and ask nuxt to stop listening to file changes
|
|
afterAll(async () => {
|
|
await nuxt.close()
|
|
})
|
|
})
|