37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import Vue from 'vue'
|
|
import { shallowMount } 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()
|
|
})
|
|
})
|