Skip to content
Prev Previous commit
Next Next commit
test(wallet): move the trailing-zero cases into the formatTokenBalanc…
…eFull tests

One case per truncation branch, beside the existing formatter tests.
  • Loading branch information
askalf committed Sep 29, 2026
commit 7b6127dcc48ffd651d9bf73a975d8c8febd16358
10 changes: 10 additions & 0 deletions src/main/wallet-balances.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ describe("formatTokenBalanceFull", () => {
it("formats fractions with 4 significant digits", () => {
expect(formatTokenBalanceFull("123400000000000000", 18)).toBe("0.1234");
});

it("trims zeros exposed by the 4-digit cut", () => {
// 1.20001 tokens → "1.2" not "1.2000"
expect(formatTokenBalanceFull("1200010000000000000", 18)).toBe("1.2");
});

it("trims zeros exposed by the cut below 1", () => {
// 0.0001200005 tokens → "0.00012"
expect(formatTokenBalanceFull("120000500000000", 18)).toBe("0.00012");
});
});

describe("formatTokenBalance precision for huge balances", () => {
Expand Down
69 changes: 0 additions & 69 deletions src/main/wallet-balances.trailing-zeros.test.ts

This file was deleted.