diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/amount-field-unit-test.js | 5 |
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, []); |
