aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-08 16:45:45 -0700
committerAdam Soltys <[email protected]>2026-10-08 16:45:45 -0700
commit408395bf05c2bb8a129a19392afa356798d98a87 (patch)
treedecbb9cb3d4ff83723963a7c05bee7adeadaafc8 /tools
parent8bb6726811d3f49131af57d6a104ee7064aa8172 (diff)
downloadcoinosv3-408395bf05c2bb8a129a19392afa356798d98a87.tar.gz
coinosv3-408395bf05c2bb8a129a19392afa356798d98a87.zip
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 <[email protected]>
Diffstat (limited to 'tools')
-rw-r--r--tools/amount-field-unit-test.js5
1 files changed, 3 insertions, 2 deletions
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, []);