taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 8b6269872935c7353a397d45446a4d9ff1b540b6
parent e6aed62973e3fdf57d879e9c9b23d6ddecf3191f
Author: Florian Dold <florian.dold@gmail.com>
Date:   Thu,  9 Mar 2017 21:34:55 +0100

add test for amount arithmetic

Diffstat:
Msrc/emscriptif-test.ts | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/emscriptif-test.ts b/src/emscriptif-test.ts @@ -77,4 +77,13 @@ test("withdraw-request", (t: TestLib) => { t.pass(); }); - +test("withdraw-request", (t: TestLib) => { + const a1 = new native.Amount({currency: "KUDOS", value: 1, fraction: 50000000}); + const a2 = new native.Amount({currency: "KUDOS", value: 1, fraction: 50000000}); + a1.add(a2); + let x = a1.toJson(); + t.assert(x.currency == "KUDOS"); + t.assert(x.fraction == 0); + t.assert(x.value == 3); + t.pass(); +});