added unit tests to widgets

This commit is contained in:
woothu
2018-10-09 13:33:43 +02:00
parent b318110c7d
commit 4741d4231a
14 changed files with 233 additions and 71 deletions
+26
View File
@@ -0,0 +1,26 @@
import Vue from 'vue'
import { shallowMount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Component from '@/views/widgets/Widget02'
Vue.use(BootstrapVue)
const ComponentName = 'Widget02'
const wrapper = shallowMount(Component)
describe(ComponentName + '.vue', () => {
it('has a name', () => {
expect(Component.name).toMatch(ComponentName)
})
it('is Vue instance', () => {
expect(wrapper.isVueInstance()).toBe(true)
})
it('correctly sets default props when created', () => {
const vm = new Vue(Component).$mount()
expect(vm.header).toBe('header|string')
expect(vm.text).toBe('text|string')
expect(vm.link).toBe('#')
expect(vm.iconClasses).toBe('fa fa-cogs bg-primary')
expect(vm.showLink).toBe(false)
})
})