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
35 lines
618 B
JavaScript
35 lines
618 B
JavaScript
import { shallowMount } from '@vue/test-utils'
|
|
|
|
import Category from './index'
|
|
|
|
const localVue = global.localVue
|
|
|
|
describe('Category', () => {
|
|
let icon
|
|
let name
|
|
|
|
let Wrapper = () => {
|
|
return shallowMount(Category, {
|
|
localVue,
|
|
propsData: {
|
|
icon,
|
|
name,
|
|
},
|
|
})
|
|
}
|
|
|
|
describe('given Strings for Icon and Name', () => {
|
|
beforeEach(() => {
|
|
icon = 'mouse-cursor'
|
|
name = 'Peter'
|
|
})
|
|
|
|
it('shows Name', () => {
|
|
expect(Wrapper().text()).toContain('Peter')
|
|
})
|
|
it('shows Icon Svg', () => {
|
|
expect(Wrapper().contains('svg'))
|
|
})
|
|
})
|
|
})
|