diff --git a/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.test.tsx b/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.test.tsx index 66c3fca3ce4..23c034b7c09 100644 --- a/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.test.tsx +++ b/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.test.tsx @@ -282,4 +282,20 @@ describe(FiatExchangeCurrencyBottomSheet, () => { expect(getAllByTestId('TokenBalanceItem')[3]).toHaveTextContent('CELO') expect(getAllByTestId('TokenBalanceItem')[4]).toHaveTextContent('ETH') }) + it('renders correctly if token list is empty', () => { + const { queryByTestId, getByTestId } = render( + + + + ) + expect(queryByTestId('TokenBalanceItem')).toBeFalsy() + // asserts whether tokenList.length (0) isn't rendered, which causes a + // crash in the app + expect(getByTestId('FiatExchangeCurrencyBottomSheet')).not.toHaveTextContent('0') + }) }) diff --git a/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.tsx b/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.tsx index 357e66e23b7..6d9fc7e02ae 100644 --- a/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.tsx +++ b/src/fiatExchanges/FiatExchangeCurrencyBottomSheet.tsx @@ -65,7 +65,7 @@ function FiatExchangeCurrencyBottomSheet({ route }: Props) { > {/* padding undefined to prevent android ripple bug */} {t('sendEnterAmountScreen.selectToken')} - {tokenList.length && + {!!tokenList.length && tokenList.map((tokenInfo) => { return (