mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
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
38 lines
670 B
JavaScript
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('')
|
|
})
|
|
})
|
|
})
|