From 39d22b6584e87b71df96a4fe78082702c7d6a626 Mon Sep 17 00:00:00 2001 From: Martin Varmuza Date: Mon, 19 Jun 2023 16:01:31 +0200 Subject: [PATCH] deps(suite): use legacyFakeTimers --- packages/suite/jest.config.js | 5 +++++ .../middlewares/wallet/__tests__/pollingMiddleware.test.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/packages/suite/jest.config.js b/packages/suite/jest.config.js index 2388098e122..2d360d08f0e 100644 --- a/packages/suite/jest.config.js +++ b/packages/suite/jest.config.js @@ -67,4 +67,9 @@ module.exports = { verbose: false, watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'], testEnvironment: 'jsdom', + fakeTimers: { + enableGlobally: false, + // https://jestjs.io/docs/28.x/upgrading-to-jest28#faketimers + legacyFakeTimers: true, + }, }; diff --git a/packages/suite/src/middlewares/wallet/__tests__/pollingMiddleware.test.ts b/packages/suite/src/middlewares/wallet/__tests__/pollingMiddleware.test.ts index 2840baa09d9..902d8777512 100644 --- a/packages/suite/src/middlewares/wallet/__tests__/pollingMiddleware.test.ts +++ b/packages/suite/src/middlewares/wallet/__tests__/pollingMiddleware.test.ts @@ -88,6 +88,11 @@ describe('pollingMiddleware', () => { jest.runOnlyPendingTimers(); expect(store.getActions()).toEqual([{ type: POLLING.REQUEST, key: 'fake' }]); + // todo: + // this assertion fails without + // legacyFakeTimers: true, + // (see jest.config.js) + // https://jestjs.io/docs/28.x/upgrading-to-jest28#faketimers expect(setTimeout).toHaveBeenCalledTimes(1); });