Added one basic unittest for component
This commit is contained in:
parent
a4ce093919
commit
083b7b8e2f
|
@ -0,0 +1,10 @@
|
||||||
|
import Username from '@/components/common/Username.vue'
|
||||||
|
|
||||||
|
import { render } from '../../utils'
|
||||||
|
|
||||||
|
describe('Username', () => {
|
||||||
|
it('displays username', () => {
|
||||||
|
const vm = render(Username, {username: 'Hello'})
|
||||||
|
expect(vm.$el.textContent).to.equal('Hello')
|
||||||
|
})
|
||||||
|
})
|
|
@ -1,4 +1,11 @@
|
||||||
// helper for testing action with expected mutations
|
// helper for testing action with expected mutations
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
export const render = (Component, propsData) => {
|
||||||
|
const Constructor = Vue.extend(Component)
|
||||||
|
return new Constructor({ propsData: propsData }).$mount()
|
||||||
|
}
|
||||||
|
|
||||||
export const testAction = ({action, payload, params, expectedMutations, expectedActions}, done) => {
|
export const testAction = ({action, payload, params, expectedMutations, expectedActions}, done) => {
|
||||||
let mutationsCount = 0
|
let mutationsCount = 0
|
||||||
let actionsCount = 0
|
let actionsCount = 0
|
||||||
|
|
Loading…
Reference in New Issue