test: restore and fix unit tests
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import Vue from 'vue'
|
||||
import { shallowMount, mount } from '@vue/test-utils'
|
||||
import CoreuiVue from '@coreui/vue'
|
||||
import Alerts from '@/views/notifications/Alerts'
|
||||
|
||||
Vue.use(CoreuiVue)
|
||||
|
||||
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')
|
||||
})
|
||||
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)
|
||||
})
|
||||
test('renders correctly', () => {
|
||||
const wrapper = shallowMount(Alerts)
|
||||
expect(wrapper.element).toMatchSnapshot()
|
||||
})
|
||||
it('should have methods', () => {
|
||||
expect(typeof Alerts.methods.showAlert ).toEqual('function')
|
||||
expect(Alerts.methods.showAlert()).toBeUndefined()
|
||||
expect(typeof Alerts.methods.countDownChanged ).toEqual('function')
|
||||
expect(Alerts.methods.countDownChanged(10)).toBeUndefined()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user