test: added basic unit tests (except for charts). Unit tests segregated in directories.
This commit is contained in:
@@ -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')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user