mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
more tests for all nav-items
This commit is contained in:
parent
f0e6793074
commit
c7c25f2077
@ -7,6 +7,10 @@ const apolloMutateMock = jest.fn()
|
|||||||
const storeDispatchMock = jest.fn()
|
const storeDispatchMock = jest.fn()
|
||||||
const routerPushMock = jest.fn()
|
const routerPushMock = jest.fn()
|
||||||
|
|
||||||
|
const stubs = {
|
||||||
|
RouterLink: true,
|
||||||
|
}
|
||||||
|
|
||||||
const mocks = {
|
const mocks = {
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn((t) => t),
|
||||||
$apollo: {
|
$apollo: {
|
||||||
@ -28,7 +32,7 @@ describe('NavBar', () => {
|
|||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(NavBar, { mocks, localVue })
|
return mount(NavBar, { mocks, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
@ -41,13 +45,35 @@ describe('NavBar', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('Navbar Menu', () => {
|
||||||
|
it('has a link to overview', () => {
|
||||||
|
expect(wrapper.findAll('.nav-item').at(0).find('a').attributes('href')).toBe('/')
|
||||||
|
})
|
||||||
|
it('has a link to /user', () => {
|
||||||
|
expect(wrapper.findAll('.nav-item').at(1).find('a').attributes('href')).toBe('/user')
|
||||||
|
})
|
||||||
|
it('has a link to /creation', () => {
|
||||||
|
expect(wrapper.findAll('.nav-item').at(2).find('a').attributes('href')).toBe('/creation')
|
||||||
|
})
|
||||||
|
it('has a link to /creation-confirm', () => {
|
||||||
|
expect(wrapper.findAll('.nav-item').at(3).find('a').attributes('href')).toBe(
|
||||||
|
'/creation-confirm',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
it('has a link to /contribution-link', () => {
|
||||||
|
expect(wrapper.findAll('.nav-item').at(4).find('a').attributes('href')).toBe(
|
||||||
|
'/contribution-link',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('wallet', () => {
|
describe('wallet', () => {
|
||||||
const assignLocationSpy = jest.fn()
|
const assignLocationSpy = jest.fn()
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await wrapper.findAll('a').at(6).trigger('click')
|
await wrapper.findAll('.nav-item').at(5).find('a').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('changes widnow location to wallet', () => {
|
it.skip('changes window location to wallet', () => {
|
||||||
expect(assignLocationSpy).toBeCalledWith('valid-token')
|
expect(assignLocationSpy).toBeCalledWith('valid-token')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -63,7 +89,7 @@ describe('NavBar', () => {
|
|||||||
window.location = {
|
window.location = {
|
||||||
assign: windowLocationMock,
|
assign: windowLocationMock,
|
||||||
}
|
}
|
||||||
await wrapper.findAll('a').at(7).trigger('click')
|
await wrapper.findAll('.nav-item').at(6).find('a').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('redirects to /logout', () => {
|
it('redirects to /logout', () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user