Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unmocked block tracker warning in GasFeeController tests #5297

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
21 changes: 19 additions & 2 deletions packages/gas-fee-controller/src/GasFeeController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
NetworkState,
} from '@metamask/network-controller';
import type { Hex } from '@metamask/utils';
import nock from 'nock';
import * as sinon from 'sinon';

import {
Expand Down Expand Up @@ -76,12 +77,28 @@ const setupNetworkController = async ({
allowedEvents: [],
});

const infuraProjectId = '123';

const networkController = new NetworkController({
messenger: restrictedMessenger,
state,
infuraProjectId: '123',
infuraProjectId,
});

nock('https://mainnet.infura.io')
.post(`/v3/${infuraProjectId}`, {
id: /^\d+$/u,
jsonrpc: '2.0',
method: 'eth_blockNumber',
params: [],
})
.reply(200, {
id: 1,
jsonrpc: '2.0',
result: '0x1',
})
.persist();

if (initializeProvider) {
// Call this without awaiting to simulate what the extension or mobile app
// might do
Expand Down Expand Up @@ -291,7 +308,7 @@ describe('GasFeeController', () => {
);
});

afterEach(() => {
afterEach(async () => {
gasFeeController.destroy();
const { blockTracker } = networkController.getProviderAndBlockTracker();
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
Expand Down
Loading