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
+28
View File
@@ -0,0 +1,28 @@
import Vue from 'vue'
import { shallowMount } from '@vue/test-utils'
import CoreuiVue from '@coreui/vue'
import Login from '@/views/pages/Login'
Vue.use(CoreuiVue)
describe('Login.vue', () => {
it('has a name', () => {
expect(Login.name).toMatch('Login')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Login)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Login', () => {
const wrapper = shallowMount(Login)
expect(wrapper.is(Login)).toBe(true)
})
it('should render correct content', () => {
const wrapper = shallowMount(Login)
expect(wrapper.find('h1').text()).toMatch('Login')
})
test('renders correctly', () => {
const wrapper = shallowMount(Login)
expect(wrapper.element).toMatchSnapshot()
})
})
+28
View File
@@ -0,0 +1,28 @@
import Vue from 'vue'
import { shallowMount } from '@vue/test-utils'
import CoreuiVue from '@coreui/vue'
import Page404 from '@/views/pages/Page404'
Vue.use(CoreuiVue)
describe('Page404.vue', () => {
it('has a name', () => {
expect(Page404.name).toMatch('Page404')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Page404)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Page500', () => {
const wrapper = shallowMount(Page404)
expect(wrapper.is(Page404)).toBe(true)
})
it('should render correct content', () => {
const wrapper = shallowMount(Page404)
expect(wrapper.find('h1').text()).toMatch('404')
})
test('renders correctly', () => {
const wrapper = shallowMount(Page404)
expect(wrapper.element).toMatchSnapshot()
})
})
+28
View File
@@ -0,0 +1,28 @@
import Vue from 'vue'
import { shallowMount } from '@vue/test-utils'
import CoreuiVue from '@coreui/vue'
import Page500 from '@/views/pages/Page500'
Vue.use(CoreuiVue)
describe('Page500.vue', () => {
it('has a name', () => {
expect(Page500.name).toMatch('Page500')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Page500)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Page500', () => {
const wrapper = shallowMount(Page500)
expect(wrapper.is(Page500)).toBe(true)
})
it('should render correct content', () => {
const wrapper = shallowMount(Page500)
expect(wrapper.find('h1').text()).toMatch('500')
})
test('renders correctly', () => {
const wrapper = shallowMount(Page500)
expect(wrapper.element).toMatchSnapshot()
})
})
+28
View File
@@ -0,0 +1,28 @@
import Vue from 'vue'
import { shallowMount } from '@vue/test-utils'
import CoreuiVue from '@coreui/vue'
import Register from '@/views/pages/Register'
Vue.use(CoreuiVue)
describe('Register.vue', () => {
it('has a name', () => {
expect(Register.name).toMatch('Register')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Register)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Register', () => {
const wrapper = shallowMount(Register)
expect(wrapper.is(Register)).toBe(true)
})
it('should render correct content', () => {
const wrapper = shallowMount(Register)
expect(wrapper.find('h1').text()).toMatch('Register')
})
test('renders correctly', () => {
const wrapper = shallowMount(Register)
expect(wrapper.element).toMatchSnapshot()
})
})
@@ -0,0 +1,126 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Login.vue renders correctly 1`] = `
<ccontainer-stub
class="c-d-flex c-align-items-center c-min-vh-100"
>
<crow-stub
class="c-justify-content-center"
>
<ccol-stub
md="8"
tag="div"
>
<ccardgroup-stub>
<ccard-stub
class="c-p-4"
subtitletag="h6"
titletag="h4"
>
<ccardbody-stub
subtitletag="h6"
titletag="h4"
>
<cform-stub>
<h1>
Login
</h1>
<p
class="c-text-muted"
>
Sign In to your account
</p>
<cforminput-stub
autocomplete="username email"
lazy="400"
placeholder="Username"
prependhtml=<i class='cui-user'></i>
type="text"
/>
<cforminput-stub
autocomplete="curent-password"
lazy="400"
placeholder="Password"
prependhtml=<i class='cui-lock-locked'></i>
type="password"
/>
<crow-stub>
<ccol-stub
col="6"
tag="div"
>
<cbutton-stub
activeclass="c-active"
class="c-px-4"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
type="button"
variant="primary"
>
Login
</cbutton-stub>
</ccol-stub>
<ccol-stub
class="c-text-right"
col="6"
tag="div"
>
<cbutton-stub
activeclass="c-active"
class="c-px-0"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
type="button"
variant="link"
>
Forgot password?
</cbutton-stub>
</ccol-stub>
</crow-stub>
</cform-stub>
</ccardbody-stub>
</ccard-stub>
<ccard-stub
bodywrapper="true"
class="c-text-white c-text-center c-bg-primary c-py-5 c-d-md-down-none"
subtitletag="h6"
titletag="h4"
>
<h2>
Sign up
</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>
<cbutton-stub
activeclass="c-active"
class="c-active c-mt-3"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
type="button"
variant="primary"
>
Register Now!
</cbutton-stub>
</ccard-stub>
</ccardgroup-stub>
</ccol-stub>
</crow-stub>
</ccontainer-stub>
`;
@@ -0,0 +1,50 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Page404.vue renders correctly 1`] = `
<ccontainer-stub
class="c-d-flex c-align-items-center c-min-vh-100"
>
<crow-stub
class="c-w-100 c-justify-content-center"
>
<ccol-stub
md="6"
tag="div"
>
<div
class="c-w-100"
>
<div
class="c-clearfix"
>
<h1
class="c-float-left c-display-3 c-mr-4"
>
404
</h1>
<h4
class="c-pt-3"
>
Oops! You're lost.
</h4>
<p
class="c-text-muted"
>
The page you are looking for was not found.
</p>
</div>
<cforminput-stub
class="c-mb-0"
lazy="400"
placeholder="What are you looking for?"
prependhtml=<i class='cui-magnifying-glass'></i>
type="text"
/>
</div>
</ccol-stub>
</crow-stub>
</ccontainer-stub>
`;
@@ -0,0 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Page500.vue renders correctly 1`] = `
<ccontainer-stub
class="c-d-flex c-align-items-center c-min-vh-100"
>
<crow-stub
class="c-w-100 c-justify-content-center"
>
<ccol-stub
md="6"
tag="div"
>
<div
class="c-clearfix"
>
<h1
class="c-float-left c-display-3 c-mr-4"
>
500
</h1>
<h4
class="c-pt-3"
>
Houston, we have a problem!
</h4>
<p
class="c-text-muted"
>
The page you are looking for is temporarily unavailable.
</p>
</div>
<cforminput-stub
class="c-mb-0"
lazy="400"
placeholder="What are you looking for?"
prependhtml=<i class='cui-magnifying-glass'></i>
type="text"
/>
</ccol-stub>
</crow-stub>
</ccontainer-stub>
`;
@@ -0,0 +1,129 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Register.vue renders correctly 1`] = `
<ccontainer-stub
class="c-min-vh-100 c-d-flex c-align-items-center"
>
<crow-stub
class="c-w-100 c-justify-content-center"
>
<ccol-stub
md="6"
sm="8"
tag="div"
>
<ccard-stub
class="c-mx-4"
subtitletag="h6"
titletag="h4"
>
<ccardbody-stub
class="c-p-4"
subtitletag="h6"
titletag="h4"
>
<cform-stub>
<h1>
Register
</h1>
<p
class="c-text-muted"
>
Create your account
</p>
<cforminput-stub
autocomplete="username"
lazy="400"
placeholder="Username"
prependhtml=<i class='cui-user'></i>
type="text"
/>
<cforminput-stub
autocomplete="email"
lazy="400"
placeholder="Email"
prependhtml="@"
type="text"
/>
<cforminput-stub
autocomplete="new-password"
lazy="400"
placeholder="Password"
prependhtml=<i class='cui-lock-locked'></i>
type="password"
/>
<cforminput-stub
autocomplete="new-password"
class="c-mb-4"
lazy="400"
placeholder="Repeat password"
prependhtml=<i class='cui-lock-locked'></i>
type="password"
/>
<cbutton-stub
activeclass="c-active"
block="true"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
type="button"
variant="success"
>
Create Account
</cbutton-stub>
</cform-stub>
</ccardbody-stub>
<ccardfooter-stub
class="c-p-4"
subtitletag="h6"
titletag="h4"
>
<crow-stub>
<ccol-stub
col="6"
tag="div"
>
<cbutton-stub
activeclass="c-active"
block="true"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
texthtml="Facebook"
type="button"
variant="facebook"
/>
</ccol-stub>
<ccol-stub
col="6"
tag="div"
>
<cbutton-stub
activeclass="c-active"
block="true"
event="click"
exactactiveclass="c-active"
routertag="a"
target="_self"
texthtml="Twitter"
type="button"
variant="twitter"
/>
</ccol-stub>
</crow-stub>
</ccardfooter-stub>
</ccard-stub>
</ccol-stub>
</crow-stub>
</ccontainer-stub>
`;