Skip to content

Commit

Permalink
[token-detection-controller] test: Restore publishes for `networkDidC…
Browse files Browse the repository at this point in the history
…hange` event, mock polygon network client
  • Loading branch information
MajorLift committed Jan 8, 2024
1 parent 4e65ccc commit a49fbb1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/assets-controllers/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = merge(baseConfig, {
// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 88.36,
branches: 89.09,
functions: 97.08,
lines: 97.23,
statements: 97.28,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ import {
} from '@metamask/controller-utils';
import { defaultState as defaultNetworkState } from '@metamask/network-controller';
import type {
BlockTrackerProxy,
NetworkController,
NetworkState,
ProviderConfig,
ProviderProxy,
} from '@metamask/network-controller';
import type { AutoManagedNetworkClient } from '@metamask/network-controller/src/create-auto-managed-network-client';
import type {
Expand Down Expand Up @@ -177,7 +174,6 @@ describe('TokenDetectionController', () => {
ReturnType<AssetsContractController['getBalancesInSingleCall']>
>;

const networkDidChangeEvent = jest.fn<NetworkState, []>();
let getNetworkClientByIdHandler = jest.fn();
const getNetworkClientByIdInfuraHandler = jest.fn<
AutoManagedNetworkClient<InfuraNetworkClientConfiguration>,
Expand All @@ -188,7 +184,7 @@ describe('TokenDetectionController', () => {
Parameters<NetworkController['getNetworkClientById']>
>();
const changeNetwork = (providerConfig: ProviderConfig) => {
networkDidChangeEvent.mockReturnValue({
controllerMessenger.publish('NetworkController:networkDidChange', {
...defaultNetworkState,
providerConfig,
selectedNetworkClientId: providerConfig.id ?? providerConfig.type,
Expand Down Expand Up @@ -242,9 +238,6 @@ describe('TokenDetectionController', () => {
...mainnet,
type: NetworkClientType.Infura,
},
provider: {} as ProviderProxy,
blockTracker: {} as BlockTrackerProxy,
destroy: jest.fn(),
};

beforeEach(async () => {
Expand Down

0 comments on commit a49fbb1

Please sign in to comment.