Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useSendScope } from './useSendScope';
import { getNetworkBadgeSource } from '../../utils/network';
import { getIntlNumberFormatter } from '../../../../../util/intl';
import { TokenStandard } from '../../types/token';
import { selectAssetsBySelectedAccountGroup } from '../../../../../selectors/assets/assets-list';
import { selectFilteredAssetsBySelectedAccountGroup } from '../../../../../selectors/assets/assets-list';
import { selectCurrentCurrency } from '../../../../../selectors/currencyRateController';
import { isTestNet } from '../../../../../util/networks';

Expand Down Expand Up @@ -36,7 +36,7 @@ jest.mock('../../../../../../locales/i18n', () => ({
}));

jest.mock('../../../../../selectors/assets/assets-list', () => ({
selectAssetsBySelectedAccountGroup: jest.fn(),
selectFilteredAssetsBySelectedAccountGroup: jest.fn(),
}));

jest.mock('../../../../../selectors/currencyRateController', () => ({
Expand All @@ -48,7 +48,7 @@ const mockUseSendScope = jest.mocked(useSendScope);
const mockGetNetworkBadgeSource = jest.mocked(getNetworkBadgeSource);
const mockGetIntlNumberFormatter = jest.mocked(getIntlNumberFormatter);
const mockSelectAssetsBySelectedAccountGroup = jest.mocked(
selectAssetsBySelectedAccountGroup,
selectFilteredAssetsBySelectedAccountGroup,
);
const mockSelectCurrentCurrency = jest.mocked(selectCurrentCurrency);
const mockIsTestNet = jest.mocked(isTestNet);
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('useAccountTokens', () => {
mockSelectCurrentCurrency.mockReturnValue('USD');

mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return mockAssets;
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -209,7 +209,7 @@ describe('useAccountTokens', () => {
integerAssets as any,
);
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return integerAssets;
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -245,7 +245,7 @@ describe('useAccountTokens', () => {
decimalAssets as any,
);
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return decimalAssets;
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -297,7 +297,7 @@ describe('useAccountTokens', () => {
sortTestAssets as any,
);
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return sortTestAssets;
}
if (selector === selectCurrentCurrency) {
Expand All @@ -318,7 +318,7 @@ describe('useAccountTokens', () => {
it('handles empty assets object', () => {
mockSelectAssetsBySelectedAccountGroup.mockReturnValue({});
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return {};
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -349,7 +349,7 @@ describe('useAccountTokens', () => {
assetsWithoutFiat as any,
);
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return assetsWithoutFiat;
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -380,7 +380,7 @@ describe('useAccountTokens', () => {
assetsWithoutFiat as any,
);
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return assetsWithoutFiat;
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -413,7 +413,7 @@ describe('useAccountTokens', () => {
assetsWithNullFiat as any,
);
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return assetsWithNullFiat;
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -445,7 +445,7 @@ describe('useAccountTokens', () => {
assetsWithNullFiat as any,
);
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return assetsWithNullFiat;
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -478,7 +478,7 @@ describe('useAccountTokens', () => {
testNetAssets as any,
);
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return testNetAssets;
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -512,7 +512,7 @@ describe('useAccountTokens', () => {
testNetAssets as any,
);
mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return testNetAssets;
}
if (selector === selectCurrentCurrency) {
Expand Down Expand Up @@ -553,7 +553,7 @@ describe('useAccountTokens', () => {
);

mockUseSelector.mockImplementation((selector) => {
if (selector === selectAssetsBySelectedAccountGroup) {
if (selector === selectFilteredAssetsBySelectedAccountGroup) {
return assets;
}
if (selector === selectCurrentCurrency) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useMemo } from 'react';
import { BigNumber } from 'bignumber.js';
import { Hex } from '@metamask/utils';

import { selectAssetsBySelectedAccountGroup } from '../../../../../selectors/assets/assets-list';
import { selectFilteredAssetsBySelectedAccountGroup } from '../../../../../selectors/assets/assets-list';
import { isTestNet } from '../../../../../util/networks';
import Logger from '../../../../../util/Logger';
import { selectCurrentCurrency } from '../../../../../selectors/currencyRateController';
Expand All @@ -16,7 +16,7 @@ import { useSendScope } from './useSendScope';
export function useAccountTokens({
includeNoBalance = false,
} = {}): AssetType[] {
const assets = useSelector(selectAssetsBySelectedAccountGroup);
const assets = useSelector(selectFilteredAssetsBySelectedAccountGroup);
const { isEvmOnly, isSolanaOnly } = useSendScope();
const fiatCurrency = useSelector(selectCurrentCurrency);

Expand Down
Loading
Loading