-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add jumpstart confirmation screen (#5050)
### Description This PR adds: - a new jumpstart confirmation screen. it is just displaying information at this stage. - navigation to this new screen from the enter amount screen - some analytics - unit tests for the new screen Not included: sending the transaction ### Test plan ![Simulator Screenshot - iPhone 14 Pro - 2024-03-07 at 10 38 04](https://github.com/valora-inc/wallet/assets/20150449/6600ffba-23f1-4a33-b00d-fe4c901e071b) ### Related issues - Related to RET-994 ### Backwards compatibility Y ### Network scalability Y
- Loading branch information
1 parent
09e6ff9
commit 99f92a2
Showing
12 changed files
with
339 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { fireEvent, render } from '@testing-library/react-native' | ||
import React from 'react' | ||
import { Provider } from 'react-redux' | ||
import { JumpstartEvents } from 'src/analytics/Events' | ||
import ValoraAnalytics from 'src/analytics/ValoraAnalytics' | ||
import JumpstartSendConfirmation from 'src/jumpstart/JumpstartSendConfirmation' | ||
import MockedNavigator from 'test/MockedNavigator' | ||
import { createMockStore } from 'test/utils' | ||
import { mockCusdTokenBalance, mockCusdTokenId } from 'test/values' | ||
|
||
describe('JumpstartSendConfirmation', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks() | ||
}) | ||
|
||
it('should render the correct information', () => { | ||
const { getByText } = render( | ||
<Provider store={createMockStore()}> | ||
<MockedNavigator | ||
component={JumpstartSendConfirmation} | ||
params={{ | ||
tokenId: mockCusdTokenId, | ||
sendAmount: '12.345', | ||
}} | ||
/> | ||
</Provider> | ||
) | ||
|
||
expect(getByText('jumpstartSendConfirmationScreen.title')).toBeTruthy() | ||
expect(getByText('12.35 cUSD')).toBeTruthy() // correct rounding | ||
expect(getByText('₱16.42')).toBeTruthy() // local amount parsedAmount (12.345) *exchangeRate (1.33) | ||
expect(getByText('jumpstartSendConfirmationScreen.details')).toBeTruthy() | ||
expect(getByText('jumpstartSendConfirmationScreen.confirmButton')).toBeEnabled() | ||
}) | ||
|
||
it('should execute the correct actions on press continue', () => { | ||
const { getByText } = render( | ||
<Provider store={createMockStore()}> | ||
<MockedNavigator | ||
component={JumpstartSendConfirmation} | ||
params={{ | ||
tokenId: mockCusdTokenId, | ||
sendAmount: '12.345', | ||
}} | ||
/> | ||
</Provider> | ||
) | ||
|
||
fireEvent.press(getByText('jumpstartSendConfirmationScreen.confirmButton')) | ||
|
||
expect(ValoraAnalytics.track).toHaveBeenCalledWith(JumpstartEvents.jumpstart_send_confirm, { | ||
amountInUsd: '12.35', | ||
localCurrency: 'PHP', | ||
localCurrencyExchangeRate: '1.33', | ||
networkId: mockCusdTokenBalance.networkId, | ||
tokenAmount: '12.345', | ||
tokenId: mockCusdTokenBalance.tokenId, | ||
tokenSymbol: mockCusdTokenBalance.symbol, | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.