Skip to content

Commit

Permalink
Fix login tests timing out
Browse files Browse the repository at this point in the history
Change operationsFromCache stub to remove promise as it is not an async function and finish running timers after each test
  • Loading branch information
shepherd-l committed Sep 23, 2024
1 parent 2e6e69f commit 6ec79b5
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions __test__/unit/user/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,13 @@ jest.mock('../../../src/shared/libraries/Log');
describe('Login tests', () => {
beforeEach(() => {
jest.useFakeTimers();
test.stub(
PropertiesExecutor.prototype,
'getOperationsFromCache',
Promise.resolve([]),
);
test.stub(
IdentityExecutor.prototype,
'getOperationsFromCache',
Promise.resolve([]),
);
test.stub(
SubscriptionExecutor.prototype,
'getOperationsFromCache',
Promise.resolve([]),
);
test.stub(PropertiesExecutor.prototype, 'getOperationsFromCache', []);
test.stub(IdentityExecutor.prototype, 'getOperationsFromCache', []);
test.stub(SubscriptionExecutor.prototype, 'getOperationsFromCache', []);
});

afterEach(() => {
jest.runOnlyPendingTimers();
jest.resetAllMocks();
});

Expand Down

0 comments on commit 6ec79b5

Please sign in to comment.