diff --git a/src/containers/shared/components/Currency.tsx b/src/containers/shared/components/Currency.tsx index ac48efa7c..8f72e5a1a 100644 --- a/src/containers/shared/components/Currency.tsx +++ b/src/containers/shared/components/Currency.tsx @@ -40,12 +40,19 @@ const Currency = (props: Props) => { display ) } else { - const currencyCode = + let currencyCode = currency?.length === NON_STANDARD_CODE_LENGTH && currency?.substring(0, 2) !== LP_TOKEN_IDENTIFIER ? hexToString(currency) : currency + if ( + currency?.length === NON_STANDARD_CODE_LENGTH && + currencyCode.length === 3 + ) { + currencyCode = `Fake${currencyCode}` + } + let display = `${currencyCode}` if (currencyCode === XRP && displaySymbol) { diff --git a/src/containers/shared/components/test/Currency.test.tsx b/src/containers/shared/components/test/Currency.test.tsx index 8d7de259c..b58c68c13 100644 --- a/src/containers/shared/components/test/Currency.test.tsx +++ b/src/containers/shared/components/test/Currency.test.tsx @@ -58,6 +58,13 @@ describe('Currency', () => { wrapper.unmount() }) + it('handle non-standard currency decoded to equal or fewer than 3 characters', () => { + const wrapper = mount( + , + ) + expect(wrapper.find('.currency').text()).toEqual('FakeXRP') + }) + it('displays the XRP symbol when rendering XRP', () => { const wrapper = mount() expect(wrapper.find('.currency').text()).toEqual('\uE900 XRP')