Skip to content

Commit

Permalink
fix: update to unable to find conversion rate when failing to get con…
Browse files Browse the repository at this point in the history
…version rate
  • Loading branch information
salimtb committed Dec 21, 2023
1 parent b1271ef commit d82db03
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
41 changes: 41 additions & 0 deletions app/components/UI/Tokens/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
TOTAL_BALANCE_TEXT,
} from '../../../../wdio/screen-objects/testIDs/Components/Tokens.testIds';
import initialBackgroundState from '../../../util/test/initial-background-state.json';
import { strings } from '../../../../locales/i18n';

const mockEngine = Engine;

Expand Down Expand Up @@ -185,4 +186,44 @@ describe('Tokens', () => {

expect(getByTestId(PORTFOLIO_BUTTON)).toBeDefined();
});
it('should display unable to find conversion rate', async () => {
const state = {
engine: {
backgroundState: {
...initialBackgroundState,
TokensController: {
tokens: [
{
name: 'Link',
symbol: 'LINK',
address: '0x02',
decimals: 18,
balanceFiat: '$0',
iconUrl: '',
},
],
},
TokenRatesController: {
contractExchangeRates: {
'0x02': undefined,
},
},
CurrencyRateController: {
currentCurrency: 'USD',
conversionRate: 1,
},
TokenBalancesController: {
contractBalances: {
'0x02': new BN(1),
},
},
},
},
};
const { findByText } = renderComponent(state);

expect(
await findByText(strings('wallet.unable_to_find_conversion_rate')),
).toBeDefined();
});
});
2 changes: 1 addition & 1 deletion app/components/UI/Tokens/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ const Tokens: React.FC<TokensI> = ({ tokens }) => {

if (balanceFiat === TOKEN_RATE_UNDEFINED) {
mainBalance = balanceValueFormatted;
secondaryBalance = strings('wallet.unable_to_load');
secondaryBalance = strings('wallet.unable_to_find_conversion_rate');
}

asset = { ...asset, balanceFiat };
Expand Down
3 changes: 2 additions & 1 deletion locales/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"logout_to_import_seed": "You need to log out first in order to import a Secret Recovery Phrase.",
"ready_to_explore": "Ready to start exploring blockchain applications?",
"unable_to_load": "Unable to load balance",
"unable_to_find_conversion_rate": "unable to find conversion rate",
"display_nft_media_desc": "To import an NFT, turn on Display NFT media in Settings > Security and privacy.",
"display_nft_media_cta": "Turn on Display NFT media",
"display_media_nft_warning": "Displaying NFT media and data may expose your IP address to centralized servers. Only import an NFT if you understand the risks involved.",
Expand Down Expand Up @@ -825,7 +826,7 @@
"title": "Snaps",
"description": "Overview and manage your snaps",
"snap_settings": {
"remove_snap_section_title": "Remove Snap",
"remove_snap_section_title": "Remove Snap",
"remove_snap_section_description": "This action will delete the snap, its data, and its granted permissions.",
"remove_button_label": "Remove {{snapName}}"
},
Expand Down

0 comments on commit d82db03

Please sign in to comment.