From 23158ed5c074e55ef01c3386e93b2d1e4b30411d Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sat, 13 Sep 2025 23:56:20 -0700 Subject: [PATCH] Add test for fractional nano amounts. --- test/test.tools.mjs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test.tools.mjs b/test/test.tools.mjs index d802209..cb7e312 100644 --- a/test/test.tools.mjs +++ b/test/test.tools.mjs @@ -42,11 +42,21 @@ await Promise.all([ assert.equal(result, '1000000000000000000000000000000') }) + await test("convert fractional nano to raw", async () => { + const result = Tools.convert("0.05", "NANO", "RAW") + assert.equal(result, "50000000000000000000000000000") + }) + await test('convert raw to nano', async () => { const result = Tools.convert('1000000000000000000000000000000', 'RAW', 'NANO') assert.equal(result, '1') }) + await test("convert raw to fractional nano", async () => { + const result = Tools.convert("50000000000000000000000000000", "RAW", "NANO") + assert.equal(result, "0.05") + }) + await test('convert 1 raw to 10^-29 nano', async () => { const result = Tools.convert('1', 'RAW', 'NANO') assert.equal(result, '0.000000000000000000000000000001') -- 2.47.3