diff --git a/packages/assets-controllers/src/TokensController.test.ts b/packages/assets-controllers/src/TokensController.test.ts index 5f885d8490..8522dfc18a 100644 --- a/packages/assets-controllers/src/TokensController.test.ts +++ b/packages/assets-controllers/src/TokensController.test.ts @@ -756,6 +756,7 @@ describe('TokensController', () => { [DETECTED_CHAINID]: { [DETECTED_ADDRESS]: [detectedToken], }, + '4': { '0xabc': [] }, }); expect(tokensController.state.allTokens).toStrictEqual({ @@ -763,7 +764,6 @@ describe('TokensController', () => { [CONFIGURED_ADDRESS]: [directlyAddedToken], }, }); - stub.restore(); }); }); @@ -852,6 +852,21 @@ describe('TokensController', () => { ).toStrictEqual(dummyTokens); }); + it('should nest detectedTokens under chain ID and selected address when detectedTokens provided is an empty list', () => { + tokensController.configure({ + selectedAddress: dummySelectedAddress, + chainId: NetworksChainId.mainnet, + }); + const processedTokens = tokensController._getNewAllTokensState({ + newDetectedTokens: [], + }); + expect( + processedTokens.newAllDetectedTokens[NetworksChainId.mainnet][ + dummySelectedAddress + ], + ).toStrictEqual([]); + }); + it('should nest ignoredTokens under chain ID and selected address when provided with ignoredTokens as input', () => { tokensController.configure({ selectedAddress: dummySelectedAddress,