Add unit tests and fix map load

This commit is contained in:
Conor McNamara
2023-03-20 16:15:01 +00:00
parent c408f21d91
commit aa4fd87de1
8 changed files with 9414 additions and 14 deletions

42
tests/unit/Navbar.spec.js Normal file
View 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();