Add unit tests and fix map load
This commit is contained in:
42
tests/unit/Navbar.spec.js
Normal file
42
tests/unit/Navbar.spec.js
Normal file
@ -0,0 +1,42 @@
|
||||
import { expect } from 'chai'
|
||||
import { shallowMount, RouterLinkStub } from '@vue/test-utils'
|
||||
import { nextTick } from 'vue'
|
||||
import Navbar from '@/components/Navbar.vue'
|
||||
|
||||
describe('Navbar.vue Component Test', () => {
|
||||
let wrapper;
|
||||
let componentInstance;
|
||||
beforeEach(() => {
|
||||
wrapper = shallowMount(Navbar, {
|
||||
global: {
|
||||
stubs: {
|
||||
'router-link': RouterLinkStub
|
||||
}
|
||||
}
|
||||
})
|
||||
componentInstance = wrapper.vm;
|
||||
})
|
||||
|
||||
it('Not logged in test', () => {
|
||||
expect(wrapper.text()).to.include('Irish Rail Tracker');
|
||||
expect(wrapper.text()).to.include('Home');
|
||||
expect(wrapper.text()).to.include('Insights');
|
||||
expect(wrapper.text()).to.include('Login');
|
||||
expect(wrapper.text()).to.include('Sign Up');
|
||||
}),
|
||||
|
||||
it('Logged in test', () => {
|
||||
// re-render the component
|
||||
wrapper.setData({isLoggedIn: true})
|
||||
nextTick(() => {
|
||||
expect(wrapper.text()).to.include('Irish Rail Tracker');
|
||||
expect(wrapper.text()).to.include('Home');
|
||||
expect(wrapper.text()).to.include('Insights');
|
||||
expect(wrapper.text()).to.include('Account Settings');
|
||||
expect(wrapper.text()).to.include('Logout');
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// wrapper.find('input[type=checkbox]').setChecked();
|
Reference in New Issue
Block a user