diff --git a/packages/gas-fee-controller/src/GasFeeController.test.ts b/packages/gas-fee-controller/src/GasFeeController.test.ts index 3768155aa4..53b1f821e8 100644 --- a/packages/gas-fee-controller/src/GasFeeController.test.ts +++ b/packages/gas-fee-controller/src/GasFeeController.test.ts @@ -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 { @@ -76,16 +77,32 @@ const setupNetworkController = async ({ allowedEvents: [], }); + const infuraProjectId = '123'; + const networkController = new NetworkController({ messenger: restrictedMessenger, state, - infuraProjectId: '123', + infuraProjectId, getRpcServiceOptions: () => ({ fetch, btoa, }), }); + 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