Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove dup
  • Loading branch information
NicolasMassart committed Mar 7, 2025
commit 53b4c1e0878f039a1dee8062ca04d7c2337df1fc
Original file line number Diff line number Diff line change
Expand Up @@ -1143,63 +1143,4 @@ describe('Amount', () => {
}
expect(toJSON()).toMatchSnapshot();
});

it('sets correct fiat amount for max native token', async () => {
const { getByText, getByTestId } = renderComponent({
...initialState,
engine: {
...initialState.engine,
backgroundState: {
...initialState.engine.backgroundState,
AccountTrackerController: {
accounts: {
[CURRENT_ACCOUNT]: {
balance: '4563918244F40000', // 5 ETH in hex
},
},
},
CurrencyRateController: {
currentCurrency: 'usd',
currencyRates: {
ETH: {
conversionRate: 1000, // 1 ETH = $1000
},
},
},
},
},
settings: {
...initialState.settings,
primaryCurrency: 'Fiat',
},
transaction: {
assetType: 'ETH',
selectedAsset: {
address: '',
isETH: true,
logo: '../images/eth-logo.png',
name: 'Ether',
symbol: 'ETH',
},
transaction: {
from: CURRENT_ACCOUNT,
},
},
});

// Wait for the gas estimation to complete
const nextButton = getByTestId(AmountViewSelectorsIDs.NEXT_BUTTON);
await waitFor(() => expect(nextButton.props.disabled).toBe(false));

const useMaxButton = getByText(/Use max/);
await act(async () => {
fireEvent.press(useMaxButton);
});

// The conversion should happen and update the input
const amountInput = getByTestId(AmountViewSelectorsIDs.TRANSACTION_AMOUNT_INPUT);
expect(amountInput.props.value).toBeDefined();
expect(typeof amountInput.props.value).toBe('string');
expect(amountInput.props.value).toBe('5000'); // $5000 from 5 ETH at $1000/ETH
});
});
Loading