test is no entering the catch block after logout fail

This commit is contained in:
Moriz Wahl 2021-09-28 15:41:45 +02:00
parent a0583cbb50
commit 9cecec97b0

View File

@ -32,6 +32,9 @@ describe('DashboardLayoutGdd', () => {
},
$router: {
push: routerPushMock,
currentRoute: {
path: '/overview',
},
},
$toasted: {
error: toasterMock,
@ -143,21 +146,23 @@ describe('DashboardLayoutGdd', () => {
it('redirects to login page', () => {
expect(routerPushMock).toBeCalledWith('/login')
})
})
describe('logout fails', () => {
beforeEach(() => {
apolloMock.mockRejectedValue({
message: 'error',
})
describe('logout fails', () => {
beforeEach(async () => {
apolloMock.mockRejectedValue({
message: 'error',
})
await wrapper.findComponent({ name: 'sidebar' }).vm.$emit('logout')
await flushPromises()
})
it('dispatches logout to store', () => {
expect(storeDispatchMock).toBeCalledWith('logout')
})
it('dispatches logout to store', () => {
expect(storeDispatchMock).toBeCalledWith('logout')
})
it('redirects to login page', () => {
expect(routerPushMock).toBeCalledWith('/login')
})
it('redirects to login page', () => {
expect(routerPushMock).toBeCalledWith('/login')
})
})