From 9337c2653abe87e53f72ccbf7ab7515d45c5924f Mon Sep 17 00:00:00 2001 From: dlohvinov Date: Wed, 22 Nov 2023 22:50:43 +0200 Subject: [PATCH] fix: fixed test [WTEL-3840] --- src/modules/Userinfo/components/__tests__/auth.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/Userinfo/components/__tests__/auth.spec.js b/src/modules/Userinfo/components/__tests__/auth.spec.js index 6776475d..8a62fb39 100644 --- a/src/modules/Userinfo/components/__tests__/auth.spec.js +++ b/src/modules/Userinfo/components/__tests__/auth.spec.js @@ -43,11 +43,12 @@ describe('Auth', () => { it('sets token, gets session and opens app after auth token message emit', async () => { const accessToken = 'hello there'; window.postMessage({ accessToken }, '*'); - await setTimeout(() => { + await new Promise((resolve) => setTimeout(() => { expect(authAPI.setToken).toHaveBeenCalledWith(accessToken); expect(userinfoAPI.getSession).toHaveBeenCalled(); expect(userinfoAPI.getApplicationsAccess).toHaveBeenCalled(); expect(router.replace).toHaveBeenCalled(); - }, 100); + resolve(); + }, 100)); }); });