Skip to content

Commit

Permalink
test: skip renderToString tests (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyerburgh committed May 4, 2018
1 parent d31c24c commit 1a4d12f
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions test/specs/mounting-options/provide.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import ComponentWithInject from '~resources/components/component-with-inject.vue
import { injectSupported } from '~resources/utils'
import {
describeWithMountingMethods,
itDoNotRunIf
itDoNotRunIf,
itSkipIf
} from '~resources/utils'

describeWithMountingMethods('options.provide', (mountingMethod) => {
Expand Down Expand Up @@ -57,16 +58,20 @@ describeWithMountingMethods('options.provide', (mountingMethod) => {
expect(wrapper.vm.setInBeforeCreate).to.equal('created')
})

itDoNotRunIf(!injectSupported(), 'injects the provide from the config', () => {
config.provide['fromMount'] = 'globalConfig'
itSkipIf(mountingMethod.name === 'renderToString',
'injects the provide from the config', () => {
if (!injectSupported()) {
return
}
config.provide['fromMount'] = 'globalConfig'

const wrapper = mountingMethod(ComponentWithInject)
const HTML = mountingMethod.name === 'renderToString'
? wrapper
: wrapper.html()
const wrapper = mountingMethod(ComponentWithInject)
const HTML = mountingMethod.name === 'renderToString'
? wrapper
: wrapper.html()

expect(HTML).to.contain('globalConfig')
})
expect(HTML).to.contain('globalConfig')
})

itDoNotRunIf(!injectSupported(), 'prioritize mounting options over config', () => {
config.provide['fromMount'] = 'globalConfig'
Expand All @@ -81,13 +86,14 @@ describeWithMountingMethods('options.provide', (mountingMethod) => {
expect(HTML).to.contain('_')
})

itDoNotRunIf(!injectSupported(), 'config with function throws', () => {
config.provide = () => {}
itSkipIf(mountingMethod.name === 'renderToString',
'config with function throws', () => {
config.provide = () => {}

expect(() => {
mountingMethod(ComponentWithInject, {
provide: { fromMount: '_' }
})
}).to.throw()
})
expect(() => {
mountingMethod(ComponentWithInject, {
provide: { fromMount: '_' }
})
}).to.throw()
})
})

0 comments on commit 1a4d12f

Please sign in to comment.