From aed082754926ad7acaaf2d539922d7375ba7a349 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 2 Sep 2021 07:51:56 +0200 Subject: [PATCH 1/3] fix: Flaky Test for Logout --- frontend/src/views/Layout/DashboardLayout_gdd.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index 12a788a4b..b10e0fc91 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -131,7 +131,7 @@ describe('DashboardLayoutGdd', () => { await flushPromises() }) - it('calls the API', async () => { + it('calls the API', () => { expect(apolloMock).toBeCalled() }) From 4bed49a97e9af1b0d1a4afefe61800d193600d3d Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 2 Sep 2021 08:06:04 +0200 Subject: [PATCH 2/3] mock in before each block --- frontend/src/views/Layout/DashboardLayout_gdd.spec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index b10e0fc91..bf866492e 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -127,6 +127,11 @@ describe('DashboardLayoutGdd', () => { describe('logout', () => { beforeEach(async () => { + await apolloMock.mockResolvedValue({ + data: { + logout: 'success', + }, + }) await wrapper.findComponent({ name: 'sidebar' }).vm.$emit('logout') await flushPromises() }) From fc2af656db90180fdac14ae20a0b33443a3e8962 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 2 Sep 2021 08:29:13 +0200 Subject: [PATCH 3/3] try async call --- frontend/src/views/Layout/DashboardLayout_gdd.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index bf866492e..614ddf9c4 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -136,8 +136,8 @@ describe('DashboardLayoutGdd', () => { await flushPromises() }) - it('calls the API', () => { - expect(apolloMock).toBeCalled() + it('calls the API', async () => { + await expect(apolloMock).toBeCalled() }) it('dispatches logout to store', () => {