mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-02 18:37:21 +00:00
33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
import buildConfig from '../../src/config/build'
|
|
|
|
describe('config: build', () => {
|
|
test('should return dev filenames', () => {
|
|
const { filenames } = buildConfig()
|
|
const env = { isDev: true }
|
|
expect(filenames.app(env)).toEqual('[name].js')
|
|
expect(filenames.chunk(env)).toEqual('[name].js')
|
|
expect(filenames.css(env)).toEqual('[name].css')
|
|
expect(filenames.img(env)).toEqual('[path][name].[ext]')
|
|
expect(filenames.font(env)).toEqual('[path][name].[ext]')
|
|
expect(filenames.video(env)).toEqual('[path][name].[ext]')
|
|
})
|
|
|
|
test('should return prod filenames', () => {
|
|
const { filenames } = buildConfig()
|
|
const env = { isDev: false }
|
|
expect(filenames.app(env)).toEqual('[chunkhash].js')
|
|
expect(filenames.chunk(env)).toEqual('[chunkhash].js')
|
|
expect(filenames.css(env)).toEqual('[contenthash].css')
|
|
expect(filenames.img(env)).toEqual('img/[hash:7].[ext]')
|
|
expect(filenames.font(env)).toEqual('fonts/[hash:7].[ext]')
|
|
expect(filenames.video(env)).toEqual('videos/[hash:7].[ext]')
|
|
})
|
|
|
|
test('should return modern filenames', () => {
|
|
const { filenames } = buildConfig()
|
|
const env = { isDev: true, isModern: true }
|
|
expect(filenames.app(env)).toEqual('modern-[name].js')
|
|
expect(filenames.chunk(env)).toEqual('modern-[name].js')
|
|
})
|
|
})
|