Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/subscription-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@types/jest": "^29.5.14",
"deepmerge": "^4.2.2",
"jest": "^29.7.0",
"sinon": "^9.2.4",
"ts-jest": "^29.2.5",
"typedoc": "^0.25.13",
"typedoc-plugin-missing-exports": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
TransactionType,
} from '@metamask/transaction-controller';
import type { Hex } from '@metamask/utils';
import * as sinon from 'sinon';

import {
controllerName,
Expand Down Expand Up @@ -52,7 +51,7 @@ import {
SUBSCRIPTION_STATUSES,
SubscriptionUserEvent,
} from './types';
import { advanceTime } from '../../../tests/helpers';
import { jestAdvanceTime } from '../../../tests/helpers';
import { generateMockTxMeta } from '../tests/utils';

type AllActions = MessengerActions<SubscriptionControllerMessenger>;
Expand Down Expand Up @@ -1047,21 +1046,19 @@ describe('SubscriptionController', () => {
});

describe('startPolling', () => {
let clock: sinon.SinonFakeTimers;
beforeEach(() => {
// eslint-disable-next-line import-x/namespace
clock = sinon.useFakeTimers();
jest.useFakeTimers();
});

afterEach(() => {
clock.restore();
jest.useRealTimers();
});

it('should call getSubscriptions with the correct interval', async () => {
await withController(async ({ controller }) => {
const getSubscriptionsSpy = jest.spyOn(controller, 'getSubscriptions');
controller.startPolling({});
await advanceTime({ clock, duration: 0 });
await jestAdvanceTime({ duration: 0 });
expect(getSubscriptionsSpy).toHaveBeenCalledTimes(1);
});
});
Expand All @@ -1076,7 +1073,7 @@ describe('SubscriptionController', () => {
'triggerAccessTokenRefresh',
);
controller.startPolling({});
await advanceTime({ clock, duration: 0 });
await jestAdvanceTime({ duration: 0 });
expect(triggerAccessTokenRefreshSpy).toHaveBeenCalledTimes(1);
});
});
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4968,7 +4968,6 @@ __metadata:
bignumber.js: "npm:^9.1.2"
deepmerge: "npm:^4.2.2"
jest: "npm:^29.7.0"
sinon: "npm:^9.2.4"
ts-jest: "npm:^29.2.5"
typedoc: "npm:^0.25.13"
typedoc-plugin-missing-exports: "npm:^2.0.0"
Expand Down
Loading