test: restore and fix unit tests

This commit is contained in:
woothu
2019-08-10 12:07:10 +02:00
parent f9a4949b56
commit 704e04f9f6
89 changed files with 55790 additions and 6 deletions
@@ -0,0 +1,30 @@
import CoreuiVue from '@coreui/vue'
import { shallowMount, createLocalVue } from '@vue/test-utils';
import VueRouter from 'vue-router'
import DefaultContainer from '@/containers/DefaultContainer'
const localVue = createLocalVue()
localVue.use(VueRouter)
const router = new VueRouter()
localVue.use(CoreuiVue)
describe('DefaultContainer.vue', () => {
it('has a name', () => {
expect(DefaultContainer.name).toMatch('full')
})
test('renders correctly', () => {
const wrapper = shallowMount(DefaultContainer, {
localVue,
router
})
expect(wrapper.element).toMatchSnapshot()
})
it('is Vue instance', () => {
const wrapper = shallowMount(DefaultContainer, {
localVue,
router
})
expect(wrapper.isVueInstance()).toBe(true)
})
})
@@ -0,0 +1,24 @@
import Vue from 'vue'
import CoreuiVue from '@coreui/vue'
import DefaultHeaderDropdownAccnt from '@/containers/DefaultHeaderDropdownAccnt'
import { shallowMount } from '@vue/test-utils';
Vue.use(CoreuiVue)
describe('DefaultHeaderDropdownAccnt.vue', () => {
it('has a name', () => {
expect(DefaultHeaderDropdownAccnt.name).toMatch('DefaultHeaderDropdownAccnt')
})
it('has a created hook', () => {
expect(typeof DefaultHeaderDropdownAccnt.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof DefaultHeaderDropdownAccnt.data).toMatch('function')
const defaultData = DefaultHeaderDropdownAccnt.data()
expect(defaultData.itemsCount).toBe(42)
})
test('renders correctly', () => {
const wrapper = shallowMount(DefaultHeaderDropdownAccnt)
expect(wrapper.element).toMatchSnapshot()
})
})
+14
View File
@@ -0,0 +1,14 @@
import Vue from 'vue'
import CoreuiVue from '@coreui/vue'
import TheFooter from '@/containers/TheFooter'
import { shallowMount } from '@vue/test-utils';
Vue.use(CoreuiVue)
describe('TheFooter.vue', () => {
test('renders correctly', () => {
const wrapper = shallowMount(TheFooter)
expect(wrapper.element).toMatchSnapshot()
})
})
+13
View File
@@ -0,0 +1,13 @@
import Vue from 'vue'
import CoreuiVue from '@coreui/vue'
import TheHeader from '@/containers/TheHeader'
import { shallowMount } from '@vue/test-utils';
Vue.use(CoreuiVue)
describe('TheHeader.vue', () => {
test('renders correctly', () => {
const wrapper = shallowMount(TheHeader)
expect(wrapper.element).toMatchSnapshot()
})
})
+16
View File
@@ -0,0 +1,16 @@
import Vue from 'vue'
import { shallowMount } from '@vue/test-utils';
import CoreuiVue from '@coreui/vue'
import TheSidebar from '@/containers/TheSidebar'
Vue.use(CoreuiVue)
describe('TheSidebar.vue', () => {
it('has a name', () => {
expect(TheSidebar.name).toMatch('TheSidebar')
})
test('renders correctly', () => {
const wrapper = shallowMount(TheSidebar)
expect(wrapper.element).toMatchSnapshot()
})
})
@@ -0,0 +1,31 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DefaultContainer.vue renders correctly 1`] = `
<div
class="c-app c-default-layout"
>
<theheader-stub />
<thesidebar-stub />
<div
class="c-body"
>
<main
class="c-main"
>
<cbreadcrumbrouter-stub />
<ccontainer-stub
fluid="true"
>
<router-view-stub
name="fade"
/>
</ccontainer-stub>
</main>
</div>
<thefooter-stub />
</div>
`;
@@ -0,0 +1,242 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DefaultHeaderDropdownAccnt.vue renders correctly 1`] = `
<cdropdown-stub
addmenuclasses="c-dropdown-menu-right"
buttonhtml="Dropdown"
nav="true"
nocaret="true"
nopopper="true"
variant="primary"
>
<cdropdownheader-stub
class="c-text-center"
tag="div"
>
<strong>
Account
</strong>
</cdropdownheader-stub>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-bell"
/>
Updates
<cbadge-stub
activeclass="c-active"
additional-classes="hehe"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="info"
>
42
</cbadge-stub>
</cdropdownitem-stub>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-envelope-open"
/>
Messages
<cbadge-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="success"
>
42
</cbadge-stub>
</cdropdownitem-stub>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-task"
/>
Tasks
<cbadge-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="danger"
>
42
</cbadge-stub>
</cdropdownitem-stub>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-comment-square"
/>
Comments
<cbadge-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="warning"
>
42
</cbadge-stub>
</cdropdownitem-stub>
<cdropdownheader-stub
class="c-text-center"
tag="div"
>
<strong>
Settings
</strong>
</cdropdownheader-stub>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-user"
/>
Profile
</cdropdownitem-stub>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-wrench"
/>
Settings
</cdropdownitem-stub>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-dollar"
/>
Payments
<cbadge-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="secondary"
>
42
</cbadge-stub>
</cdropdownitem-stub>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-file"
/>
Projects
<cbadge-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="primary"
>
42
</cbadge-stub>
</cdropdownitem-stub>
<cdropdowndivider-stub
tag="div"
/>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-shield"
/>
Lock Account
</cdropdownitem-stub>
<cdropdownitem-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
>
<i
class="cui-lock-locked"
/>
Logout
</cdropdownitem-stub>
</cdropdown-stub>
`;
@@ -0,0 +1,35 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TheFooter.vue renders correctly 1`] = `
<cfooter-stub>
<div>
<a
href="https://coreui.io"
>
CoreUI
</a>
<span
class="c-ml-1"
>
© 2018 creativeLabs.
</span>
</div>
<div
class="c-ml-auto"
>
<span
class="c-mr-1"
>
Powered by
</span>
<a
href="https://coreui.io"
>
CoreUI for Vue
</a>
</div>
</cfooter-stub>
`;
@@ -0,0 +1,145 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TheHeader.vue renders correctly 1`] = `
<cheader-stub
fixed="true"
>
<csidebartoggler-stub
class="c-header-toggler c-d-lg-none"
/>
<clink-stub
activeclass="c-active"
class="c-header-brand"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
to="/"
variant="primary"
>
<img
alt="CoreUI Logo"
class="c-navbar-brand-full"
height="25"
src="img/brand/logo.svg"
width="89"
/>
</clink-stub>
<csidebartoggler-stub
class="c-header-toggler c-d-md-down-none"
/>
<ul
class="c-header-nav c-d-md-down-none"
>
<cnavitem-stub
activeclass="c-active"
class="c-px-3"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
to="/dashboard"
variant="primary"
>
Dashboard
</cnavitem-stub>
<cnavitem-stub
activeclass="c-active"
class="c-px-3"
event="click"
exact="true"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
to="/users"
variant="primary"
>
Users
</cnavitem-stub>
<cnavitem-stub
activeclass="c-active"
class="c-px-3"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="primary"
>
Settings
</cnavitem-stub>
</ul>
<cnav-stub
class="c-header-nav c-ml-auto"
>
<cnavitem-stub
activeclass="c-active"
class="c-d-md-down-none"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="primary"
>
<i
class="cui-bell"
/>
<cbadge-stub
activeclass="c-active"
event="click"
exactactiveclass="c-active"
pill="true"
routertag="a"
tag="span"
target="_self"
variant="danger"
>
5
</cbadge-stub>
</cnavitem-stub>
<cnavitem-stub
activeclass="c-active"
class="c-d-md-down-none"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="primary"
>
<i
class="cui-list"
/>
</cnavitem-stub>
<cnavitem-stub
activeclass="c-active"
class="d-md-down-none"
event="click"
exactactiveclass="c-active"
routertag="a"
tag="span"
target="_self"
variant="primary"
>
<i
class="cui-location-pin"
/>
</cnavitem-stub>
<defaultheaderdropdownaccnt-stub />
</cnav-stub>
</cheader-stub>
`;
@@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TheSidebar.vue renders correctly 1`] = `
<csidebar-stub
breakpoint="lg"
dropdownbehaviors="closeOnInactiveRoute"
fixed="true"
show="true"
>
<csidebarheader-stub />
<csidebarform-stub />
<csidebarnav-stub
navitems="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"
/>
<csidebarfooter-stub />
<csidebarminimizer-stub />
</csidebar-stub>
`;