test: added basic unit tests (except for charts). Unit tests segregated in directories.

This commit is contained in:
woothu
2018-10-12 10:01:54 +02:00
parent 364c951ef2
commit ceee8b07ca
45 changed files with 70 additions and 2 deletions
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Alerts from '@/views/notifications/Alerts'
Vue.use(BootstrapVue)
describe('Alerts.vue', () => {
it('has a name', () => {
expect(Alerts.name).toMatch('alerts')
})
it('has a created hook', () => {
expect(typeof Alerts.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Alerts.data).toMatch('function')
const defaultData = Alerts.data()
expect(defaultData.showDismissibleAlert).toBe(false)
})
it('is Vue instance', () => {
const wrapper = shallowMount(Alerts)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Alerts', () => {
const wrapper = shallowMount(Alerts)
expect(wrapper.is(Alerts)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Alerts)
expect(wrapper.find('header.card-header > div').text()).toMatch('Bootstrap Alert docs')
})
})
+24
View File
@@ -0,0 +1,24 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Badges from '@/views/notifications/Badges'
Vue.use(BootstrapVue)
describe('Badges.vue', () => {
it('has a name', () => {
expect(Badges.name).toMatch('badges')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Badges)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Badges', () => {
const wrapper = shallowMount(Badges)
expect(wrapper.is(Badges)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Badges)
expect(wrapper.find('header.card-header > div').text()).toMatch('Bootstrap Badge docs')
})
})
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Modals from '@/views/notifications/Modals'
Vue.use(BootstrapVue)
describe('Modals.vue', () => {
it('has a name', () => {
expect(Modals.name).toMatch('modals')
})
it('has a created hook', () => {
expect(typeof Modals.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Modals.data).toMatch('function')
const defaultData = Modals.data()
expect(defaultData.largeModal).toBe(false)
})
it('is Vue instance', () => {
const wrapper = shallowMount(Modals)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Modals', () => {
const wrapper = shallowMount(Modals)
expect(wrapper.is(Modals)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Modals)
expect(wrapper.find('div.card-header > div').text()).toMatch('Bootstrap Modals')
})
})