Alina Beck 77f4810ddc set up global localVue
by setting up localVue with all required plugins (such as styleguide and vuex)
in a separate testSetup file we can avoid doing this individually in all component tests
the testSetup is executed before each test suite, so each test file gets a fresh
instance of localVue
2019-11-20 12:31:40 +03:00

38 lines
670 B
JavaScript

import { shallowMount } from '@vue/test-utils'
import Ribbon from './index'
const localVue = global.localVue
describe('Ribbon', () => {
let text
let Wrapper = () => {
return shallowMount(Ribbon, {
localVue,
propsData: {
text,
},
})
}
describe('given String for Text', () => {
beforeEach(() => {
text = 'Peter Pan'
})
it('shows Text', () => {
expect(Wrapper().text()).toContain('Peter Pan')
})
})
describe('given no String for Text', () => {
beforeEach(() => {
text = undefined
})
it('shows empty Text', () => {
expect(Wrapper().text()).toContain('')
})
})
})