Nuxt/packages/config/test/config/render.test.js
2019-01-14 17:40:15 +00:00

20 lines
720 B
JavaScript

import renderConfig from '../../src/config/render'
describe('config: render', () => {
test('should return false in default shouldPrefetch', () => {
const { bundleRenderer: { shouldPrefetch } } = renderConfig()
expect(shouldPrefetch()).toEqual(false)
})
test('should return true in script/style shouldPreload', () => {
const { bundleRenderer: { shouldPreload } } = renderConfig()
expect(shouldPreload(undefined, 'script')).toEqual(true)
expect(shouldPreload(undefined, 'style')).toEqual(true)
})
test('should return false in other shouldPreload', () => {
const { bundleRenderer: { shouldPreload } } = renderConfig()
expect(shouldPreload(undefined, 'font')).toEqual(false)
})
})