Alerts.spec.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Vue from 'vue'
  2. import { shallowMount } from '@vue/test-utils'
  3. import CoreuiVue from '@coreui/vue'
  4. import Alerts from '@/views/notifications/Alerts'
  5. Vue.use(CoreuiVue)
  6. describe('Alerts.vue', () => {
  7. it('has a name', () => {
  8. expect(Alerts.name).toBe('Alerts')
  9. })
  10. it('has a created hook', () => {
  11. expect(typeof Alerts.data).toMatch('function')
  12. })
  13. it('sets the correct default data', () => {
  14. expect(typeof Alerts.data).toMatch('function')
  15. })
  16. it('is Vue instance', () => {
  17. const wrapper = shallowMount(Alerts)
  18. expect(wrapper.vm).toBeTruthy()
  19. })
  20. it('is Alerts', () => {
  21. const wrapper = shallowMount(Alerts)
  22. expect(wrapper.findComponent(Alerts)).toBeTruthy()
  23. })
  24. test('renders correctly', () => {
  25. const wrapper = shallowMount(Alerts)
  26. expect(wrapper.element).toMatchSnapshot()
  27. })
  28. it('should have methods', () => {
  29. expect(typeof Alerts.methods.showAlert ).toEqual('function')
  30. expect(Alerts.methods.showAlert()).toBeUndefined()
  31. expect(typeof Alerts.methods.countDownChanged ).toEqual('function')
  32. expect(Alerts.methods.countDownChanged(10)).toBeUndefined()
  33. expect(typeof Alerts.methods.showDismissibleAlerts ).toEqual('function')
  34. expect(Alerts.methods.showDismissibleAlerts()).toBeUndefined()
  35. })
  36. })