Skip to content

Commit

Permalink
fix tests affected by moving token description to a separate translat…
Browse files Browse the repository at this point in the history
…ion string
  • Loading branch information
sviderock committed Jan 2, 2025
1 parent 67c69ba commit 68319ed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/TokenEnterAmount.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ describe('TokenEnterAmount', () => {
</Provider>
)

expect(getByTestId('TokenEnterAmount/TokenName')).toHaveTextContent('CELO on Celo Alfajores')
expect(getByTestId('TokenEnterAmount/TokenName')).toHaveTextContent(
'tokenEnterAmount.tokenDescription, {"tokenName":"CELO","tokenNetwork":"Celo Alfajores"}'
)
expect(getByTestId('TokenEnterAmount/SwitchTokens')).toBeTruthy()
expect(getByTestId('TokenEnterAmount/TokenSelect')).toBeTruthy()
expect(getByTestId('TokenEnterAmount/TokenBalance')).toHaveTextContent(
Expand Down
24 changes: 20 additions & 4 deletions src/send/EnterAmount.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ describe('EnterAmount', () => {

expect(getByTestId('SendEnterAmount/TokenAmountInput')).toBeTruthy()
expect(getByTestId('SendEnterAmount/TokenSelect')).toHaveTextContent('ETH')
expect(getByText('ETH on Ethereum Sepolia')).toBeTruthy()
expect(
getByText(
'tokenEnterAmount.tokenDescription, {"tokenName":"ETH","tokenNetwork":"Ethereum Sepolia"}'
)
).toBeTruthy()
expect(getByTestId('SendEnterAmount/ReviewButton')).toBeDisabled()
})

Expand Down Expand Up @@ -407,12 +411,20 @@ describe('EnterAmount', () => {
)

expect(getByTestId('SendEnterAmount/TokenSelect')).toHaveTextContent('POOF')
expect(getByText('POOF on Celo Alfajores')).toBeTruthy()
expect(
getByText(
'tokenEnterAmount.tokenDescription, {"tokenName":"POOF","tokenNetwork":"Celo Alfajores"}'
)
).toBeTruthy()
fireEvent.press(getByTestId('SendEnterAmount/TokenSelect'))
await waitFor(() => expect(getByText('Ether')).toBeTruthy())
fireEvent.press(getByText('Ether'))
expect(getByTestId('SendEnterAmount/TokenSelect')).toHaveTextContent('ETH')
expect(getByText('ETH on Ethereum Sepolia')).toBeTruthy()
expect(
getByText(
'tokenEnterAmount.tokenDescription, {"tokenName":"ETH","tokenNetwork":"Ethereum Sepolia"}'
)
).toBeTruthy()
expect(AppAnalytics.track).toHaveBeenCalledTimes(2)
expect(AppAnalytics.track).toHaveBeenCalledWith(SendEvents.token_dropdown_opened, {
currentNetworkId: NetworkId['celo-alfajores'],
Expand Down Expand Up @@ -846,7 +858,11 @@ describe('EnterAmount', () => {
</Provider>
)
expect(queryByTestId('SendEnterAmount/Fee')).toBeFalsy()
expect(getByText('CELO on Celo Alfajores')).toBeTruthy()
expect(
getByText(
'tokenEnterAmount.tokenDescription, {"tokenName":"CELO","tokenNetwork":"Celo Alfajores"}'
)
).toBeTruthy()

fireEvent.changeText(getByTestId('SendEnterAmount/TokenAmountInput'), '8')
fireEvent.changeText(getByTestId('SendEnterAmount/TokenAmountInput'), '9')
Expand Down

0 comments on commit 68319ed

Please sign in to comment.