From 3e22bbb7b0085f9ede6e5d7f293ce0f5bae7419c Mon Sep 17 00:00:00 2001 From: Niranjana Binoy <43930900+NiranjanaBinoy@users.noreply.github.com> Date: Tue, 13 Dec 2022 17:03:39 -0500 Subject: [PATCH] updating test --- .../src/TokensController.test.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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,