2019-02-04 10:34:04 +00:00
|
|
|
import BuildContext from '../../src/context/build'
|
|
|
|
|
|
|
|
describe('builder: buildContext', () => {
|
|
|
|
test('should construct context', () => {
|
|
|
|
const builder = {
|
|
|
|
nuxt: { options: {} }
|
|
|
|
}
|
|
|
|
const context = new BuildContext(builder)
|
|
|
|
expect(context._builder).toEqual(builder)
|
|
|
|
expect(context.nuxt).toEqual(builder.nuxt)
|
|
|
|
expect(context.options).toEqual(builder.nuxt.options)
|
|
|
|
expect(context.isStatic).toEqual(false)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('should return builder plugins context', () => {
|
|
|
|
const builder = {
|
|
|
|
plugins: [],
|
|
|
|
nuxt: { options: {} }
|
|
|
|
}
|
|
|
|
const context = new BuildContext(builder)
|
|
|
|
expect(context.plugins).toEqual(builder.plugins)
|
|
|
|
})
|
2019-02-18 17:00:51 +00:00
|
|
|
|
|
|
|
test('should return builder build options', () => {
|
|
|
|
const buildOptions = { id: 'test-build-options' }
|
|
|
|
const builder = {
|
|
|
|
plugins: [],
|
|
|
|
nuxt: { options: { build: buildOptions } }
|
|
|
|
}
|
|
|
|
const context = new BuildContext(builder)
|
|
|
|
expect(context.buildOptions).toEqual(buildOptions)
|
|
|
|
})
|
2019-02-04 10:34:04 +00:00
|
|
|
})
|