Users.spec.js 959 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { createLocalVue, shallowMount } from '@vue/test-utils'
  2. import CoreuiVue from '@coreui/vue'
  3. import Users from '@/views/users/Users'
  4. import VueRouter from 'vue-router';
  5. const localVue = createLocalVue()
  6. localVue.use(VueRouter)
  7. const router = new VueRouter()
  8. localVue.use(CoreuiVue)
  9. describe('Users.vue', () => {
  10. it('has a name', () => {
  11. expect(Users.name).toBe('Users')
  12. })
  13. it('has a created hook', () => {
  14. expect(typeof Users.data).toMatch('function')
  15. })
  16. it('is Vue instance', () => {
  17. const wrapper = shallowMount(Users,{
  18. localVue,
  19. router
  20. })
  21. expect(wrapper.vm).toBeTruthy()
  22. })
  23. it('is Users', () => {
  24. const wrapper = shallowMount(Users,{
  25. localVue,
  26. router
  27. })
  28. expect(wrapper.findComponent(Users)).toBeTruthy()
  29. })
  30. test('renders correctly', () => {
  31. const wrapper = shallowMount(Users, {
  32. localVue,
  33. router
  34. })
  35. expect(wrapper.element).toMatchSnapshot()
  36. })
  37. })