Skip to content

Commit 428131d

Browse files
committed
test: add missing unit tests
1 parent d6432da commit 428131d

38 files changed

+669
-14
lines changed

src/components/__tests__/Aside.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { mount } from 'vue-test-utils'
2+
import Aside from "../Aside/Aside";
3+
4+
describe("Aside.vue", () => {
5+
// Inspect the raw component options
6+
it('has isFixed method', () => {
7+
expect(typeof Aside.methods.isFixed).toBe('function')
8+
})
9+
it('has isOffCanvas method', () => {
10+
expect(typeof Aside.methods.isOffCanvas).toBe('function')
11+
})
12+
it('renders correctly', () => {
13+
const wrapper = mount(Aside)
14+
expect(wrapper.element).toMatchSnapshot()
15+
expect(wrapper.is('aside')).toBe(true)
16+
expect(wrapper.classes()).toContain('aside-menu')
17+
expect(wrapper.element.textContent).toEqual('Aside')
18+
})
19+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { mount } from "vue-test-utils";
2+
import AsideToggler from "../Aside/AsideToggler";
3+
4+
describe("AsideToggler.vue", () => {
5+
// Inspect the raw component options
6+
it('has toggle method', () => {
7+
expect(typeof AsideToggler.methods.toggle).toBe('function')
8+
})
9+
it('has asideToggle method', () => {
10+
expect(typeof AsideToggler.methods.asideToggle).toBe('function')
11+
})
12+
it('renders correctly', () => {
13+
const wrapper = mount(AsideToggler)
14+
expect(wrapper.element).toMatchSnapshot()
15+
expect(wrapper.is('button')).toBe(true)
16+
expect(wrapper.classes()).toContain('navbar-toggler')
17+
})
18+
});

src/components/__tests__/Callout.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { mount } from "vue-test-utils";
2+
import Callout from "../Callout/Callout";
3+
4+
describe("Callout.vue", () => {
5+
// Inspect the raw component options
6+
it("should have default props", () => {
7+
const wrapper = mount(Callout, {
8+
propsData: {
9+
variant: ''
10+
}
11+
})
12+
expect(wrapper.props().variant).toBe('')
13+
});
14+
it('has classList computed property', () => {
15+
expect(typeof Callout.computed.classList).toBe('function')
16+
})
17+
it('has calloutVariant computed property', () => {
18+
expect(typeof Callout.computed.calloutVariant).toBe('function')
19+
})
20+
it('renders correctly', () => {
21+
const wrapper = mount(Callout)
22+
expect(wrapper.element).toMatchSnapshot()
23+
expect(wrapper.element.textContent).toEqual('Callout')
24+
expect(wrapper.classes()).toContain('callout')
25+
})
26+
});

src/components/__tests__/Footer.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { mount } from "vue-test-utils";
2+
import Footer from "../Footer/Footer";
3+
4+
describe("Footer.vue", () => {
5+
// Inspect the raw component options
6+
it('has isFixed method', () => {
7+
expect(typeof Footer.methods.isFixed).toBe('function')
8+
})
9+
it('renders correctly', () => {
10+
const wrapper = mount(Footer)
11+
expect(wrapper.element).toMatchSnapshot()
12+
expect(wrapper.element.textContent).toEqual('Footer')
13+
expect(wrapper.classes()).toContain('app-footer')
14+
})
15+
});

src/components/__tests__/Header.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { mount } from "vue-test-utils";
2+
import Header from "../Header/Header";
3+
4+
describe("Header.vue", () => {
5+
// Inspect the raw component options
6+
it('has isFixed method', () => {
7+
expect(typeof Header.methods.isFixed).toBe('function')
8+
})
9+
it('renders correctly', () => {
10+
const wrapper = mount(Header)
11+
expect(wrapper.element).toMatchSnapshot()
12+
expect(wrapper.element.textContent).toEqual('Header')
13+
expect(wrapper.classes()).toContain('app-header')
14+
expect(wrapper.classes()).toContain('navbar')
15+
})
16+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { mount } from 'vue-test-utils'
2+
import HeaderDropdown from '../Header/HeaderDropdown';
3+
4+
describe("HeaderDropdown.vue", () => {
5+
// Inspect the raw component options
6+
it("should have default props", () => {
7+
const wrapper = mount(HeaderDropdown, {
8+
propsData: {
9+
right: false,
10+
noCaret: false
11+
}
12+
})
13+
expect(wrapper.props().right).toBe(false)
14+
expect(wrapper.props().noCaret).toBe(false)
15+
});
16+
it('renders correctly', () => {
17+
const wrapper = mount(HeaderDropdown)
18+
expect(wrapper.element).toMatchSnapshot()
19+
expect(wrapper.find('span').text()).toBe('dropdown')
20+
expect(wrapper.find('span').classes()).toContain('text-center')
21+
})
22+
});

src/components/__tests__/Sidebar.js

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 Sidebar from "../Sidebar/Sidebar";
3+
4+
describe("Sidebar.vue", () => {
5+
// Inspect the raw component options
6+
it("should have default props", () => {
7+
const wrapper = mount(Sidebar, {
8+
propsData: {
9+
fixed: false,
10+
}
11+
})
12+
expect(wrapper.props().fixed).toBe(false)
13+
});
14+
it('has isFixed method', () => {
15+
expect(typeof Sidebar.methods.isFixed).toBe('function')
16+
})
17+
it('renders correctly', () => {
18+
const wrapper = mount(Sidebar)
19+
expect(wrapper.element).toMatchSnapshot()
20+
expect(wrapper.text()).toBe('Sidebar')
21+
expect(wrapper.classes()).toContain('sidebar')
22+
})
23+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { mount } from 'vue-test-utils'
2+
import SidebarFooter from "../Sidebar/SidebarFooter";
3+
4+
describe("SidebarFooter.vue", () => {
5+
// Inspect the raw component options
6+
it('has hasSlotDefault computed property', () => {
7+
expect(typeof SidebarFooter.computed.hasSlotDefault).toBe('function')
8+
})
9+
it('renders correctly', () => {
10+
const wrapper = mount(SidebarFooter, { slots: { default: 'test'}})
11+
expect(wrapper.element).toMatchSnapshot()
12+
expect(wrapper.classes()).toContain('sidebar-footer')
13+
})
14+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { mount } from 'vue-test-utils'
2+
import SidebarForm from "../Sidebar/SidebarForm";
3+
4+
describe("SidebarForm.vue", () => {
5+
// Inspect the raw component options
6+
it('has hasSlotDefault computed property', () => {
7+
expect(typeof SidebarForm.computed.hasSlotDefault).toBe('function')
8+
})
9+
it('renders correctly', () => {
10+
const wrapper = mount(SidebarForm, { slots: { default: 'test'}})
11+
expect(wrapper.element).toMatchSnapshot()
12+
expect(wrapper.classes()).toContain('sidebar-form')
13+
})
14+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { mount } from 'vue-test-utils'
2+
import SidebarHeader from "../Sidebar/SidebarHeader";
3+
4+
describe("SidebarHeader.vue", () => {
5+
// Inspect the raw component options
6+
it('has hasSlotDefault computed property', () => {
7+
expect(typeof SidebarHeader.computed.hasSlotDefault).toBe('function')
8+
})
9+
it('renders correctly', () => {
10+
const wrapper = mount(SidebarHeader, { slots: { default: 'test'}})
11+
expect(wrapper.element).toMatchSnapshot()
12+
expect(wrapper.classes()).toContain('sidebar-header')
13+
})
14+
});

0 commit comments

Comments
 (0)