Skip to content

Commit c074e15

Browse files
committed
test: Added tests
1 parent f9c12b2 commit c074e15

File tree

136 files changed

+3199
-395
lines changed

Some content is hidden

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

136 files changed

+3199
-395
lines changed

src/__tests__/index.js

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

src/components/Aside/AsideToggler.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:class="classList"
66
type="button"
77
@click="asideToggle">
8-
<span class="navbar-toggler-icon" />
8+
<span class="navbar-toggler-icon" />
99
</button>
1010
</template>
1111

src/components/Aside/CAsideToggler.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:class="classList"
66
type="button"
77
@click="asideToggle">
8-
<span class="navbar-toggler-icon" />
8+
<span class="navbar-toggler-icon" />
99
</button>
1010
</template>
1111

src/components/__tests__/Aside.js renamed to src/components/Aside/tests/Aside.spec.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import { mount } from '@vue/test-utils'
2-
import Aside from "../Aside/Aside";
2+
import Component from "../Aside";
33

4-
describe("Aside.vue", () => {
4+
const ComponentName = 'Aside'
5+
const wrapper = mount(Component)
6+
7+
describe(`${ComponentName} .vue`, () => {
8+
it('has a name', () => {
9+
expect(Component.name).toMatch(ComponentName)
10+
})
511
// Inspect the raw component options
612
it('has isFixed method', () => {
7-
expect(typeof Aside.methods.isFixed).toBe('function')
13+
expect(typeof Component.methods.isFixed).toBe('function')
814
})
915
it('has isOffCanvas method', () => {
10-
expect(typeof Aside.methods.isOffCanvas).toBe('function')
16+
expect(typeof Component.methods.isOffCanvas).toBe('function')
1117
})
1218
it('renders correctly', () => {
13-
const wrapper = mount(Aside)
1419
expect(wrapper.element).toMatchSnapshot()
1520
expect(wrapper.is('aside')).toBe(true)
1621
expect(wrapper.classes()).toContain('aside-menu')
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { mount } from "@vue/test-utils";
2+
import Component from "../AsideToggler";
3+
4+
const ComponentName = 'AsideToggler'
5+
const wrapper = mount(Component)
6+
7+
describe(`${ComponentName} .vue`, () => {
8+
it('has a name', () => {
9+
expect(Component.name).toMatch(ComponentName)
10+
})
11+
// Inspect the raw component options
12+
it('has toggle method', () => {
13+
expect(typeof Component.methods.toggle).toBe('function')
14+
})
15+
it('has asideToggle method', () => {
16+
expect(typeof Component.methods.asideToggle).toBe('function')
17+
})
18+
it('renders correctly', () => {
19+
expect(wrapper.element).toMatchSnapshot()
20+
expect(wrapper.is('button')).toBe(true)
21+
expect(wrapper.classes()).toContain('navbar-toggler')
22+
})
23+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { mount } from '@vue/test-utils'
2+
import Component from "../CAside";
3+
4+
const ComponentName = 'CAside'
5+
const wrapper = mount(Component)
6+
7+
describe(`${ComponentName} .vue`, () => {
8+
it('has a name', () => {
9+
expect(Component.name).toMatch(ComponentName)
10+
})
11+
// Inspect the raw component options
12+
it('has isFixed method', () => {
13+
expect(typeof Component.methods.isFixed).toBe('function')
14+
})
15+
it('has isOffCanvas method', () => {
16+
expect(typeof Component.methods.isOffCanvas).toBe('function')
17+
})
18+
it('renders correctly', () => {
19+
expect(wrapper.element).toMatchSnapshot()
20+
expect(wrapper.is('aside')).toBe(true)
21+
expect(wrapper.classes()).toContain('aside-menu')
22+
expect(wrapper.element.textContent).toEqual('Aside')
23+
})
24+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { mount } from "@vue/test-utils";
2+
import Component from "../CAsideToggler";
3+
4+
const ComponentName = 'CAsideToggler'
5+
const wrapper = mount(Component)
6+
7+
describe(`${ComponentName} .vue`, () => {
8+
it('has a name', () => {
9+
expect(Component.name).toMatch(ComponentName)
10+
})
11+
// Inspect the raw component options
12+
it('has toggle method', () => {
13+
expect(typeof Component.methods.toggle).toBe('function')
14+
})
15+
it('has asideToggle method', () => {
16+
expect(typeof Component.methods.asideToggle).toBe('function')
17+
})
18+
it('renders correctly', () => {
19+
expect(wrapper.element).toMatchSnapshot()
20+
expect(wrapper.is('button')).toBe(true)
21+
expect(wrapper.classes()).toContain('navbar-toggler')
22+
})
23+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Aside .vue renders correctly 1`] = `
4+
<aside
5+
class="aside-menu"
6+
>
7+
Aside
8+
</aside>
9+
`;
10+
11+
exports[`Aside.vue renders correctly 1`] = `
12+
<aside
13+
class="aside-menu"
14+
>
15+
Aside
16+
</aside>
17+
`;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`AsideToggler .vue renders correctly 1`] = `
4+
<button
5+
class="navbar-toggler"
6+
display="lg"
7+
type="button"
8+
>
9+
<span
10+
class="navbar-toggler-icon"
11+
/>
12+
</button>
13+
`;
14+
15+
exports[`AsideToggler.vue renders correctly 1`] = `
16+
<button
17+
class="navbar-toggler"
18+
display="lg"
19+
type="button"
20+
>
21+
<span
22+
class="navbar-toggler-icon"
23+
/>
24+
</button>
25+
`;

src/components/__tests__/__snapshots__/Aside.js.snap renamed to src/components/Aside/tests/__snapshots__/CAside.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Aside.vue renders correctly 1`] = `
3+
exports[`CAside .vue renders correctly 1`] = `
44
<aside
55
class="aside-menu"
66
>

0 commit comments

Comments
 (0)