Skip to content

Commit

Permalink
deps(suite): use legacyFakeTimers
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed Jun 19, 2023
1 parent ca75b08 commit 39d22b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/suite/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down

0 comments on commit 39d22b6

Please sign in to comment.