Skip to content

Commit

Permalink
chore(cleanup): Remove show_get_started feature gate (#6300)
Browse files Browse the repository at this point in the history
### Description

Title

### Test plan

CI

### Related issues

- Part of ACT-1443

### Backwards compatibility

Yes
### Network scalability

If a new NetworkId and/or Network are added in the future, the changes
in this PR will:

- N/A
  • Loading branch information
finnian0826 authored Dec 6, 2024
1 parent 9ac2e1b commit 9aa4ebc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 78 deletions.
1 change: 0 additions & 1 deletion src/statsig/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export enum StatsigFeatureGates {
APP_REVIEW = 'app_review',
SHOW_IMPORT_TOKENS_FLOW = 'show_import_tokens_flow',
SAVE_CONTACTS = 'save_contacts',
SHOW_GET_STARTED = 'show_get_started',
CLEVERTAP_INBOX = 'clevertap_inbox',
SHOW_SWAP_TOKEN_FILTERS = 'show_swap_token_filters',
SHUFFLE_SWAP_TOKENS_ORDER = 'shuffle_swap_tokens_order',
Expand Down
31 changes: 1 addition & 30 deletions src/transactions/feed/TransactionFeed.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,22 +271,6 @@ describe('TransactionFeed', () => {
expect(items.length).toBe(1)
})

it('renders the loading indicator while it loads', async () => {
const { getByTestId, queryByTestId } = renderScreen({})
expect(getByTestId('NoActivity/loading')).toBeDefined()
expect(queryByTestId('NoActivity/error')).toBeNull()
expect(queryByTestId('TransactionList')).toBeNull()
})

it("renders an error screen if there's no cache and the query fails", async () => {
mockFetch.mockReject(new Error('Test error'))

const { getByTestId, queryByTestId } = renderScreen({})
await waitFor(() => getByTestId('NoActivity/error'))
expect(queryByTestId('NoActivity/loading')).toBeNull()
expect(queryByTestId('TransactionList')).toBeNull()
})

it('renders the cache if there is one', async () => {
mockFetch.mockReject(new Error('Test error'))

Expand Down Expand Up @@ -433,11 +417,8 @@ describe('TransactionFeed', () => {
expect(getNumTransactionItems(tree.getByTestId('TransactionList'))).toBe(11)
})

it('renders GetStarted if SHOW_GET_STARTED is enabled and transaction feed is empty', async () => {
it('renders GetStarted if transaction feed is empty', async () => {
jest.mocked(getFeatureGate).mockImplementation((gate) => {
if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
return true
}
if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
return false
}
Expand All @@ -450,9 +431,6 @@ describe('TransactionFeed', () => {

it('renders NoActivity for UK compliance', () => {
jest.mocked(getFeatureGate).mockImplementation((gate) => {
if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
return true
}
if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
return true
}
Expand All @@ -464,11 +442,4 @@ describe('TransactionFeed', () => {
expect(getByTestId('NoActivity/loading')).toBeTruthy()
expect(getByText('transactionFeed.noTransactions')).toBeTruthy()
})

it('renders NoActivity by default if transaction feed is empty', async () => {
jest.mocked(getFeatureGate).mockReturnValue(false)
const { getByTestId, getByText } = renderScreen({})
expect(getByTestId('NoActivity/loading')).toBeDefined()
expect(getByText('transactionFeed.noTransactions')).toBeTruthy()
})
})
7 changes: 1 addition & 6 deletions src/transactions/feed/TransactionFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function TransactionFeed() {
const allConfirmedStandbyTransactions = useSelector(confirmedStandbyTransactionsSelector)
const allowedNetworks = useAllowedNetworkIdsForTransfers()

const showGetStarted = getFeatureGate(StatsigFeatureGates.SHOW_GET_STARTED)
const showUKCompliantVariant = getFeatureGate(StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT)

const confirmedFeedTransactions = useMemo(() => {
Expand Down Expand Up @@ -123,11 +122,7 @@ function TransactionFeed() {
}

if (!sections.length) {
return showGetStarted && !showUKCompliantVariant ? (
<GetStarted />
) : (
<NoActivity loading={loading} error={error} />
)
return !showUKCompliantVariant ? <GetStarted /> : <NoActivity loading={loading} error={error} />
}

return (
Expand Down
41 changes: 4 additions & 37 deletions src/transactions/feed/TransactionFeedV2.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react'
import { Provider } from 'react-redux'
import { type ReactTestInstance } from 'react-test-renderer'
import AppAnalytics from 'src/analytics/AppAnalytics'
import { SwapEvents } from 'src/analytics/Events'
import { FiatExchangeEvents, SwapEvents } from 'src/analytics/Events'
import { type ApiReducersKeys } from 'src/redux/apiReducersList'
import { type RootState } from 'src/redux/reducers'
import { reducersList } from 'src/redux/reducersList'
Expand Down Expand Up @@ -149,19 +149,6 @@ describe('TransactionFeedV2', () => {
expect(tree.getByTestId('TransactionList').props.data).toHaveLength(0)
})

it("renders no transactions and an error message if there's no cache and the query fails", async () => {
mockFetch.mockReject(new Error('Test error'))
const tree = renderScreen()

expect(tree.queryByText('transactionFeed.error.fetchError')).toBeFalsy()
expect(tree.getByTestId('TransactionList/loading')).toBeTruthy()

await waitFor(() => expect(tree.getByText('transactionFeed.error.fetchError')).toBeTruthy())
expect(tree.queryByTestId('TransactionList/loading')).toBeNull()
expect(tree.getByText('transactionFeed.noTransactions')).toBeTruthy()
expect(tree.getByTestId('TransactionList').props.data).toHaveLength(0)
})

it('renders correctly when there are confirmed transactions and stand by transactions', async () => {
mockFetch.mockResponse(typedResponse({ transactions: [mockTransaction()] }))

Expand Down Expand Up @@ -236,22 +223,13 @@ describe('TransactionFeedV2', () => {
expect(tree.getByText('transactionFeed.allTransactionsShown')).toBeTruthy()
})

it('renders GetStarted if SHOW_GET_STARTED is enabled and transaction feed is empty', async () => {
it('renders GetStarted if transaction feed is empty', async () => {
mockFetch.mockResponse(
typedResponse({
transactions: [],
pageInfo: { hasNextPage: false, endCursor: '', hasPreviousPage: false, startCursor: '' },
})
)
jest.mocked(getFeatureGate).mockImplementation((gate) => {
if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
return true
}
if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
return false
}
throw new Error('Unexpected gate')
})

const tree = renderScreen()

Expand All @@ -263,9 +241,6 @@ describe('TransactionFeedV2', () => {
it('renders NoActivity for UK compliance', () => {
mockFetch.mockResponse(typedResponse({ transactions: [] }))
jest.mocked(getFeatureGate).mockImplementation((gate) => {
if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
return true
}
if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
return true
}
Expand All @@ -280,15 +255,6 @@ describe('TransactionFeedV2', () => {

it('renders GetStarted with an error if the initial fetch fails', async () => {
mockFetch.mockReject(new Error('test error'))
jest.mocked(getFeatureGate).mockImplementation((gate) => {
if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
return true
}
if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
return false
}
throw new Error('Unexpected gate')
})

const tree = renderScreen()
expect(tree.getByTestId('GetStarted')).toBeTruthy()
Expand Down Expand Up @@ -597,7 +563,8 @@ describe('TransactionFeedV2', () => {
crossChainFeeAmount: '0.5',
crossChainFeeAmountUsd: 500,
})
expect(AppAnalytics.track).toBeCalledTimes(1)
expect(AppAnalytics.track).toBeCalledWith(FiatExchangeEvents.cico_add_get_started_impression)
expect(AppAnalytics.track).toBeCalledTimes(2)
})

it('should pre-populate persisted first page of the feed', async () => {
Expand Down
5 changes: 1 addition & 4 deletions src/transactions/feed/TransactionFeedV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ export default function TransactionFeedV2() {
const { t } = useTranslation()
const dispatch = useDispatch()

const showGetStarted = getFeatureGate(StatsigFeatureGates.SHOW_GET_STARTED)
const showUKCompliantVariant = getFeatureGate(StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT)

const allowedNetworkForTransfers = useAllowedNetworksForTransfers()
Expand Down Expand Up @@ -518,9 +517,7 @@ export default function TransactionFeedV2() {
<NotificationBox showOnlyHomeScreenNotifications={true} />
</>
}
ListEmptyComponent={
showGetStarted && !showUKCompliantVariant ? <GetStarted /> : <NoActivity />
}
ListEmptyComponent={!showUKCompliantVariant ? <GetStarted /> : <NoActivity />}
ListFooterComponent={
<>
{/* prevent loading indicator due to polling from showing at the bottom of the screen */}
Expand Down

0 comments on commit 9aa4ebc

Please sign in to comment.