From 69af536ebbb7ff24aa93a496db2149dfa4ad75c5 Mon Sep 17 00:00:00 2001 From: Tom McGuire Date: Wed, 14 Feb 2024 15:42:17 -0800 Subject: [PATCH] chore: remove show receive amount in select provider feature gate (#4859) ### Description The `show_receive_amount_in_select_provider` feature gate has been rolled out to 100% since v1.62.0. This is to remove the code path for when that gate returned false. ### Test plan - Tested locally on iOS - Unit Tests updated - E2E tests updated ### Related issues - Fixes ACT-1076 ### Backwards compatibility Yes --- e2e/src/usecases/OnRamps.js | 10 - src/fiatExchanges/FiatExchangeAmount.test.tsx | 29 +-- src/fiatExchanges/FiatExchangeAmount.tsx | 46 ----- .../PaymentMethodSection.test.tsx | 118 +----------- src/fiatExchanges/PaymentMethodSection.tsx | 78 ++------ src/fiatExchanges/SelectProvider.test.tsx | 4 +- src/fiatExchanges/SelectProvider.tsx | 8 +- .../FiatExchangeAmount.test.tsx.snap | 172 ------------------ .../quotes/normalizeQuotes.test.ts | 59 +----- src/fiatExchanges/quotes/normalizeQuotes.ts | 24 +-- src/statsig/constants.ts | 1 - src/statsig/types.ts | 1 - 12 files changed, 37 insertions(+), 513 deletions(-) diff --git a/e2e/src/usecases/OnRamps.js b/e2e/src/usecases/OnRamps.js index 8b5fd696bdb..62ce658618b 100644 --- a/e2e/src/usecases/OnRamps.js +++ b/e2e/src/usecases/OnRamps.js @@ -42,11 +42,6 @@ export default onRamps = () => { device.getPlatform() === 'ios' ? cardProviders.label.split(' ')[0] : cardProviders.text.split(' ')[0] - await element(by.id('Card/section')).tap() - // Check that best rate is displayed first - await expect( - element(by.id('Card/provider-0').withDescendant(by.id('Card/bestRate'))) - ).toExist() // Check that the expected number of providers show for (let i = 0; i < numCardProviders; i++) { await expect(element(by.id(`Card/provider-${i}`))).toExist() @@ -64,11 +59,6 @@ export default onRamps = () => { device.getPlatform() === 'ios' ? bankProviders.label.split(' ')[0] : bankProviders.text.split(' ')[0] - await element(by.id('Bank/section')).tap() - // Check that best rate is displayed first - await expect( - element(by.id('Bank/provider-0').withDescendant(by.id('Bank/bestRate'))) - ).toExist() // Check that the expected number of providers show for (let i = 0; i < numBankProviders; i++) { await expect(element(by.id(`Bank/provider-${i}`))).toExist() diff --git a/src/fiatExchanges/FiatExchangeAmount.test.tsx b/src/fiatExchanges/FiatExchangeAmount.test.tsx index 82ae9595dd7..5a0de1c0bdb 100644 --- a/src/fiatExchanges/FiatExchangeAmount.test.tsx +++ b/src/fiatExchanges/FiatExchangeAmount.test.tsx @@ -12,7 +12,7 @@ import { Screens } from 'src/navigator/Screens' import { getFeatureGate } from 'src/statsig' import { NetworkId } from 'src/transactions/types' import { CiCoCurrency } from 'src/utils/currencies' -import { createMockStore, getElementText, getMockStackScreenProps } from 'test/utils' +import { createMockStore, getMockStackScreenProps } from 'test/utils' import { mockCeloAddress, mockCeloTokenId, @@ -243,51 +243,30 @@ describe('FiatExchangeAmount cashOut', () => { }) it('displays correctly for cUSD when local currency is USD', () => { - const { getByText, getByTestId } = render( + const { getByText } = render( ) expect(getByText('amount (cUSD)')).toBeTruthy() - expect(getElementText(getByTestId('LineItemRowTitle/subtotal'))).toBe('cUSD @ $1.00') - expect(getElementText(getByTestId('LineItemRow/subtotal'))).toBe('$0.00') - expect(getByText('disclaimerFiat, {"currency":"cUSD"}')).toBeTruthy() }) it('displays correctly for cEUR when local currency is USD', () => { - const { getByText, getByTestId } = render( + const { getByText } = render( ) expect(getByText('amount (cEUR)')).toBeTruthy() - expect(getElementText(getByTestId('LineItemRowTitle/subtotal'))).toBe('cEUR @ $1.20') - expect(getElementText(getByTestId('LineItemRow/subtotal'))).toBe('$0.00') - expect(getByText('disclaimerFiat, {"currency":"cEUR"}')).toBeTruthy() }) it('displays correctly for CELO when local currency is USD', () => { - const { getByText, getByTestId } = render( + const { getByText } = render( ) expect(getByText('amount (CELO)')).toBeTruthy() - expect(getElementText(getByTestId('LineItemRowTitle/subtotal'))).toBe('CELO @ $5.00') - expect(getElementText(getByTestId('LineItemRow/subtotal'))).toBe('$0.00') - }) - - it('displays correctly when the SHOW_RECEIVE_AMOUNT_IN_SELECT_PROVIDER feature flag is on', () => { - jest.mocked(getFeatureGate).mockReturnValue(true) - const { getByText, queryByTestId, queryByText } = render( - - - - ) - expect(getByText('amount (cUSD)')).toBeTruthy() - expect(queryByTestId('LineItemRowTitle/subtotal')).toBeFalsy() - expect(queryByTestId('LineItemRow/subtotal')).toBeFalsy() - expect(queryByText('disclaimerFiat, {"currency":"cUSD"}')).toBeFalsy() }) it('disables the next button if the cUSD amount is 0', () => { diff --git a/src/fiatExchanges/FiatExchangeAmount.tsx b/src/fiatExchanges/FiatExchangeAmount.tsx index f49efce9c95..3525d9ca024 100644 --- a/src/fiatExchanges/FiatExchangeAmount.tsx +++ b/src/fiatExchanges/FiatExchangeAmount.tsx @@ -17,8 +17,6 @@ import Button, { BtnSizes, BtnTypes } from 'src/components/Button' import Dialog from 'src/components/Dialog' import KeyboardAwareScrollView from 'src/components/KeyboardAwareScrollView' import KeyboardSpacer from 'src/components/KeyboardSpacer' -import LineItemRow from 'src/components/LineItemRow' -import TokenDisplay from 'src/components/TokenDisplay' import { ALERT_BANNER_DURATION, DOLLAR_ADD_FUNDS_MAX_AMOUNT } from 'src/config' import { useMaxSendAmount } from 'src/fees/hooks' import { FeeType } from 'src/fees/reducer' @@ -37,8 +35,6 @@ import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import DisconnectBanner from 'src/shared/DisconnectBanner' -import { getFeatureGate } from 'src/statsig' -import { StatsigFeatureGates } from 'src/statsig/types' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' @@ -94,10 +90,6 @@ function FiatExchangeAmount({ route }: Props) { overLocalLimitDisplayString = ` (${localCurrencySymbol}${roundUp(localCurrencyMaxAmount)})` } - const showExchangeRate = !getFeatureGate( - StatsigFeatureGates.SHOW_RECEIVE_AMOUNT_IN_SELECT_PROVIDER - ) - const dispatch = useDispatch() function isNextButtonValid() { @@ -213,37 +205,7 @@ function FiatExchangeAmount({ route }: Props) { testID="FiatExchangeInput" /> - {showExchangeRate && ( - - {`${tokenSymbol} @ `} - { - - } - - } - amount={ - - } - /> - )} - {showExchangeRate && ( - {t('disclaimerFiat', { currency: tokenSymbol })} - )}