From 408395bf05c2bb8a129a19392afa356798d98a87 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 8 Oct 2026 16:45:45 -0700 Subject: Max in fiat sends every sat: the figure a Max fill wrote is remembered with its exact sats, so the cent-rounded amount no longer parses back a few sats short and strands them. Anything typed parses as typed Co-Authored-By: Claude Opus 5.5 --- tools/amount-field-unit-test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/amount-field-unit-test.js b/tools/amount-field-unit-test.js index 26c5357..b984064 100644 --- a/tools/amount-field-unit-test.js +++ b/tools/amount-field-unit-test.js @@ -33,7 +33,7 @@ try { await page.waitForFunction(() => window.amtApp); const r = await page.evaluate(() => { const { ctx } = amtApp; - const out = { unit: amtApp.unit, fiat: ctx.amountField(62212), back: ctx.parseAmount(ctx.amountField(62212), 'fiat') }; + const out = { unit: amtApp.unit, fiat: ctx.amountField(62212), back: ctx.parseAmount(ctx.amountField(62212), 'fiat'), typed: ctx.parseAmount('93.310', 'fiat') }; while (amtApp.unit !== 'sats') amtApp.toggleUnit(); out.sats = ctx.amountField(62212); amtApp.toggleUnit(); out.btc = ctx.amountField(62212); @@ -42,7 +42,8 @@ try { console.log(r); assert.equal(r.unit, 'fiat'); assert.equal(r.fiat, '93.31', '62,212 sats at 150,000 CAD/BTC = 93.318 → floored to 93.31'); - assert(r.back <= 62212 && r.back > 62200, 'parses back to at most the maximum'); + assert.equal(r.back, 62212, 'the filled figure parses back to the exact sats — none left behind'); + assert.equal(r.typed, 62207, 'the same money typed as something else parses as typed'); assert.equal(r.sats, '62212'); assert.equal(r.btc, '0.00062212'); assert.deepEqual(errors, []); -- cgit v1.2.3