Skip to content

Commit aa064d3

Browse files
committed
tests(unit): add more test cases and snapshots
1 parent e5a3e32 commit aa064d3

File tree

88 files changed

+55320
-49
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+55320
-49
lines changed

tests/unit/Users.spec.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/unit/DefaultAside.spec.js renamed to tests/unit/containers/DefaultAside.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Vue from 'vue'
2+
import { shallowMount } from '@vue/test-utils';
23
import BootstrapVue from 'bootstrap-vue'
34
import DefaultAside from '@/containers/DefaultAside'
45

@@ -8,4 +9,8 @@ describe('DefaultAside.vue', () => {
89
it('has a name', () => {
910
expect(DefaultAside.name).toMatch('DefaultAside')
1011
})
12+
test('renders correctly', () => {
13+
const wrapper = shallowMount(DefaultAside)
14+
expect(wrapper.element).toMatchSnapshot()
15+
})
1116
})

tests/unit/DefaultContainer.spec.js renamed to tests/unit/containers/DefaultContainer.spec.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import BootstrapVue from 'bootstrap-vue'
2-
import { shallowMount, createLocalVue } from '@vue/test-utils'
2+
import { shallowMount, createLocalVue } from '@vue/test-utils';
33
import VueRouter from 'vue-router'
44
import DefaultContainer from '@/containers/DefaultContainer'
55

@@ -11,11 +11,18 @@ localVue.use(BootstrapVue)
1111

1212
describe('DefaultContainer.vue', () => {
1313
it('has a name', () => {
14-
expect(DefaultContainer.name).toMatch('full')
14+
expect(DefaultContainer.name).toMatch('DefaultContainer')
1515
})
1616
it('has a created hook', () => {
1717
expect(typeof DefaultContainer.data).toMatch('function')
1818
})
19+
test('renders correctly', () => {
20+
const wrapper = shallowMount(DefaultContainer, {
21+
localVue,
22+
router
23+
})
24+
expect(wrapper.element).toMatchSnapshot()
25+
})
1926
it('sets the correct default data', () => {
2027
expect(typeof DefaultContainer.data).toMatch('function')
2128
const defaultData = DefaultContainer.data()

tests/unit/DefaultHeaderDropdownAccnt.spec.js renamed to tests/unit/containers/DefaultHeaderDropdownAccnt.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Vue from 'vue'
22
import BootstrapVue from 'bootstrap-vue'
33
import DefaultHeaderDropdownAccnt from '@/containers/DefaultHeaderDropdownAccnt'
4+
import { shallowMount } from '@vue/test-utils';
45

56
Vue.use(BootstrapVue)
67

@@ -16,4 +17,8 @@ describe('DefaultHeaderDropdownAccnt.vue', () => {
1617
const defaultData = DefaultHeaderDropdownAccnt.data()
1718
expect(defaultData.itemsCount).toBe(42)
1819
})
20+
test('renders correctly', () => {
21+
const wrapper = shallowMount(DefaultHeaderDropdownAccnt)
22+
expect(wrapper.element).toMatchSnapshot()
23+
})
1924
})

0 commit comments

Comments
 (0)