Problem
The src/utils/formatting.ts file handles critical BigNumber conversions (e.g., formatStroops), but has no test coverage to prove it protects against precision loss or invalid inputs.
Expected behavior
A test suite is added that explicitly passes edge-case inputs (large numbers, zero, NaN strings) into formatStroops, formatCurrency, and truncateAddress to verify robust behavior.
Files to update
src/utils/formatting.test.ts (create)
Project relevance
Mathematically guarantees that the UI will not crash or display incorrect balances when receiving unpredictable XDR values from the blockchain.
Acceptance criteria
Problem
The
src/utils/formatting.tsfile handles critical BigNumber conversions (e.g.,formatStroops), but has no test coverage to prove it protects against precision loss or invalid inputs.Expected behavior
A test suite is added that explicitly passes edge-case inputs (large numbers, zero,
NaNstrings) intoformatStroops,formatCurrency, andtruncateAddressto verify robust behavior.Files to update
src/utils/formatting.test.ts(create)Project relevance
Mathematically guarantees that the UI will not crash or display incorrect balances when receiving unpredictable XDR values from the blockchain.
Acceptance criteria
formatStroops("invalid")safely returns"0.00"