diff --git a/front/test/unit/specs/components/common.spec.js b/front/test/unit/specs/components/common.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..1af4144ca858bb1c264d43cc602994569ce8fc8b --- /dev/null +++ b/front/test/unit/specs/components/common.spec.js @@ -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') + }) +}) diff --git a/front/test/unit/utils.js b/front/test/unit/utils.js index 233ee982e5221e0997da8bd29d33cfac17a113e3..6471fc97f710385ff20dcfe2fdd4ee9ac7b9ec36 100644 --- a/front/test/unit/utils.js +++ b/front/test/unit/utils.js @@ -1,4 +1,11 @@ // 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) => { let mutationsCount = 0 let actionsCount = 0