Merge pull request #1024 from gradido/flaky-logout-test

fix: Flaky Dashboard Layout Test on Logout
This commit is contained in:
Moriz Wahl 2021-10-20 15:55:15 +02:00 committed by GitHub
commit 66c92d2198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,8 @@ import DashboardLayoutGdd from './DashboardLayout_gdd'
jest.useFakeTimers()
jest.setTimeout(30000)
const localVue = global.localVue
const storeDispatchMock = jest.fn()
@ -137,6 +139,7 @@ describe('DashboardLayoutGdd', () => {
})
await wrapper.findComponent({ name: 'sidebar' }).vm.$emit('logout')
await flushPromises()
await wrapper.vm.$nextTick()
})
it('calls the API', async () => {
@ -168,6 +171,17 @@ describe('DashboardLayoutGdd', () => {
it('redirects to login page', () => {
expect(routerPushMock).toBeCalledWith('/login')
})
describe('redirect to login already done', () => {
beforeEach(() => {
mocks.$router.currentRoute.path = '/login'
jest.resetAllMocks()
})
it('does not call the redirect to login', () => {
expect(routerPushMock).not.toBeCalled()
})
})
})
describe('update balance', () => {