Add more unit tests and update integration tests
This commit is contained in:
20
tests/unit/404Page.spec.js
Normal file
20
tests/unit/404Page.spec.js
Normal file
@ -0,0 +1,20 @@
|
||||
import { expect } from 'chai'
|
||||
import { shallowMount, RouterLinkStub } from '@vue/test-utils'
|
||||
import page404 from '@/pages/404Page.vue'
|
||||
|
||||
describe('404Page.vue Component Test', () => {
|
||||
let wrapper;
|
||||
beforeEach(() => {
|
||||
wrapper = shallowMount(page404, {
|
||||
global: {
|
||||
stubs: {
|
||||
'router-link': RouterLinkStub
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('Mount test', () => {
|
||||
expect(wrapper.text()).to.include('404');
|
||||
})
|
||||
})
|
35
tests/unit/LoginPage.spec.js
Normal file
35
tests/unit/LoginPage.spec.js
Normal file
@ -0,0 +1,35 @@
|
||||
import { expect } from 'chai'
|
||||
import { shallowMount, RouterLinkStub } from '@vue/test-utils'
|
||||
import { nextTick } from 'vue'
|
||||
import LoginPage from '@/pages/LoginPage.vue'
|
||||
|
||||
describe('LoginPage.vue Component Test', () => {
|
||||
let wrapper;
|
||||
beforeEach(() => {
|
||||
wrapper = shallowMount(LoginPage, {
|
||||
global: {
|
||||
stubs: {
|
||||
'router-link': RouterLinkStub
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('Mount test', () => {
|
||||
expect(wrapper.text()).to.include('Login');
|
||||
expect(wrapper.text()).to.include('Email Address');
|
||||
expect(wrapper.text()).to.include('Password');
|
||||
expect(wrapper.text()).to.include('Forgot password?');
|
||||
expect(wrapper.text()).to.include('Don\'t have an account?');
|
||||
}),
|
||||
|
||||
it('Forgot password test', () => {
|
||||
wrapper.setData({forgotPassword: true})
|
||||
nextTick(() => {
|
||||
expect(wrapper.text()).to.include('Forgot Password');
|
||||
expect(wrapper.text()).to.include('Email Address');
|
||||
expect(wrapper.text()).to.include('Send Reset Email');
|
||||
expect(wrapper.text()).to.include('Go Back');
|
||||
})
|
||||
})
|
||||
})
|
@ -36,7 +36,4 @@ describe('Navbar.vue Component Test', () => {
|
||||
expect(wrapper.text()).to.include('Logout');
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// wrapper.find('input[type=checkbox]').setChecked();
|
||||
})
|
23
tests/unit/SignUpPage.spec.js
Normal file
23
tests/unit/SignUpPage.spec.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { expect } from 'chai'
|
||||
import { shallowMount, RouterLinkStub } from '@vue/test-utils'
|
||||
import SignUpPage from '@/pages/SignUpPage.vue'
|
||||
|
||||
describe('SignUpPage.vue Component Test', () => {
|
||||
let wrapper;
|
||||
beforeEach(() => {
|
||||
wrapper = shallowMount(SignUpPage, {
|
||||
global: {
|
||||
stubs: {
|
||||
'router-link': RouterLinkStub
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('Mount test', async() => {
|
||||
expect(wrapper.text()).to.include('Sign Up');
|
||||
expect(wrapper.text()).to.include('Email Address');
|
||||
expect(wrapper.text()).to.include('Password');
|
||||
expect(wrapper.text()).to.include('Already have an account?');
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user