test: added basic unit tests (except for charts). Unit tests segregated in directories.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import Vue from 'vue'
|
||||
import BootstrapVue from 'bootstrap-vue'
|
||||
import DefaultAside from '@/containers/DefaultAside'
|
||||
|
||||
Vue.use(BootstrapVue)
|
||||
|
||||
describe('DefaultAside.vue', () => {
|
||||
it('has a name', () => {
|
||||
expect(DefaultAside.name).toMatch('DefaultAside')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,31 @@
|
||||
import BootstrapVue from 'bootstrap-vue'
|
||||
import { shallowMount, createLocalVue } from '@vue/test-utils'
|
||||
import VueRouter from 'vue-router'
|
||||
import DefaultContainer from '@/containers/DefaultContainer'
|
||||
|
||||
const localVue = createLocalVue()
|
||||
localVue.use(VueRouter)
|
||||
const router = new VueRouter()
|
||||
|
||||
localVue.use(BootstrapVue)
|
||||
|
||||
describe('DefaultContainer.vue', () => {
|
||||
it('has a name', () => {
|
||||
expect(DefaultContainer.name).toMatch('full')
|
||||
})
|
||||
it('has a created hook', () => {
|
||||
expect(typeof DefaultContainer.data).toMatch('function')
|
||||
})
|
||||
it('sets the correct default data', () => {
|
||||
expect(typeof DefaultContainer.data).toMatch('function')
|
||||
const defaultData = DefaultContainer.data()
|
||||
expect(typeof defaultData.nav).toMatch('object')
|
||||
})
|
||||
it('is Vue instance', () => {
|
||||
const wrapper = shallowMount(DefaultContainer, {
|
||||
localVue,
|
||||
router
|
||||
})
|
||||
expect(wrapper.isVueInstance()).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,19 @@
|
||||
import Vue from 'vue'
|
||||
import BootstrapVue from 'bootstrap-vue'
|
||||
import DefaultHeaderDropdownAccnt from '@/containers/DefaultHeaderDropdownAccnt'
|
||||
|
||||
Vue.use(BootstrapVue)
|
||||
|
||||
describe('DefaultHeaderDropdownAccnt.vue', () => {
|
||||
it('has a name', () => {
|
||||
expect(DefaultHeaderDropdownAccnt.name).toMatch('DefaultHeaderDropdownAccnt')
|
||||
})
|
||||
it('has a created hook', () => {
|
||||
expect(typeof DefaultHeaderDropdownAccnt.data).toMatch('function')
|
||||
})
|
||||
it('sets the correct default data', () => {
|
||||
expect(typeof DefaultHeaderDropdownAccnt.data).toMatch('function')
|
||||
const defaultData = DefaultHeaderDropdownAccnt.data()
|
||||
expect(defaultData.itemsCount).toBe(42)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user