Skip to content

Commit

Permalink
chore: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
kathaypacific committed Oct 12, 2023
1 parent 0950f69 commit 1ed0117
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/home/NotificationCenter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { NotificationBannerCTATypes, NotificationType } from 'src/home/types'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import { cancelPaymentRequest, updatePaymentRequestNotified } from 'src/paymentRequest/actions'
import { getFeatureGate } from 'src/statsig'
import { Spacing } from 'src/styles/styles'
import { multiplyByWei } from 'src/utils/formatting'
import { createMockStore, getElementText, getMockStackScreenProps } from 'test/utils'
Expand Down Expand Up @@ -40,6 +41,7 @@ jest.mock('src/navigator/NavigationService', () => ({
ensurePincode: jest.fn(async () => true),
navigate: jest.fn(),
}))
jest.mock('src/statsig')

const DEVICE_HEIGHT = 850

Expand Down Expand Up @@ -991,6 +993,30 @@ describe('NotificationCenter', () => {
expect(queryByTestId('NotificationView/start_supercharging')).toBeFalsy()
})

it('does not render start supercharging because the user is in a restricted region', () => {
jest.mocked(getFeatureGate).mockReturnValueOnce(true)

const store = createMockStore({
...superchargeWithoutRewardsSetUp,
account: {
...superchargeWithoutRewardsSetUp.account,
dismissedStartSupercharging: false,
},
tokens: {
tokenBalances: mockcUsdWithoutEnoughBalance,
},
})
const { queryByTestId } = render(
<Provider store={store}>
<NotificationCenter {...getMockStackScreenProps(Screens.NotificationCenter)} />
</Provider>
)

expect(queryByTestId('NotificationView/supercharge_available')).toBeFalsy()
expect(queryByTestId('NotificationView/supercharging')).toBeFalsy()
expect(queryByTestId('NotificationView/start_supercharging')).toBeFalsy()
})

it('emits correct analytics event when CTA button is pressed', () => {
const store = createMockStore({
...superchargeWithoutRewardsSetUp,
Expand Down

0 comments on commit 1ed0117

Please sign in to comment.