diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-30 17:08:54 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-30 17:08:54 +0200 |
commit | 008926b18470e7f394cd640302957b29728a9803 (patch) | |
tree | 45f914f5117116bb3af5010f9e7570e99b015952 /src/wallet-test.ts | |
parent | 24e021fef360448caf11ab5a489b570102e66f6f (diff) |
compute full fees for refresh and spending
Diffstat (limited to 'src/wallet-test.ts')
-rw-r--r-- | src/wallet-test.ts | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/wallet-test.ts b/src/wallet-test.ts index acd776d67..037cc7592 100644 --- a/src/wallet-test.ts +++ b/src/wallet-test.ts @@ -29,7 +29,7 @@ function a(x: string): types.AmountJson { } -function fakeCwd(current: string, value: string, feeDeposit: string): wallet.CoinWithDenom { +function fakeCwd(current: string, value: string, feeDeposit: string): types.CoinWithDenom { return { coin: { blindingKey: "(mock)", @@ -64,89 +64,89 @@ function fakeCwd(current: string, value: string, feeDeposit: string): wallet.Coi test("coin selection 1", (t) => { - const cds: wallet.CoinWithDenom[] = [ + const cds: types.CoinWithDenom[] = [ fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.1"), fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.0"), ]; - const res = wallet.selectPayCoins(cds, a("EUR:2.0"), a("EUR:0.1")); + const res = wallet.selectPayCoins([], cds, a("EUR:2.0"), a("EUR:0.1")); if (!res) { t.fail(); return; } - t.true(res.length === 2); + t.true(res.cds.length === 2); t.pass(); }); test("coin selection 2", (t) => { - const cds: wallet.CoinWithDenom[] = [ + const cds: types.CoinWithDenom[] = [ fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.0"), // Merchant covers the fee, this one shouldn't be used fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.0"), ]; - const res = wallet.selectPayCoins(cds, a("EUR:2.0"), a("EUR:0.5")); + const res = wallet.selectPayCoins([], cds, a("EUR:2.0"), a("EUR:0.5")); if (!res) { t.fail(); return; } - t.true(res.length === 2); + t.true(res.cds.length === 2); t.pass(); }); test("coin selection 3", (t) => { - const cds: wallet.CoinWithDenom[] = [ + const cds: types.CoinWithDenom[] = [ fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), // this coin should be selected instead of previous one with fee fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.0"), ]; - const res = wallet.selectPayCoins(cds, a("EUR:2.0"), a("EUR:0.5")); + const res = wallet.selectPayCoins([], cds, a("EUR:2.0"), a("EUR:0.5")); if (!res) { t.fail(); return; } - t.true(res.length === 2); + t.true(res.cds.length === 2); t.pass(); }); test("coin selection 4", (t) => { - const cds: wallet.CoinWithDenom[] = [ + const cds: types.CoinWithDenom[] = [ fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), ]; - const res = wallet.selectPayCoins(cds, a("EUR:2.0"), a("EUR:0.2")); + const res = wallet.selectPayCoins([], cds, a("EUR:2.0"), a("EUR:0.2")); if (!res) { t.fail(); return; } - t.true(res.length === 3); + t.true(res.cds.length === 3); t.pass(); }); test("coin selection 5", (t) => { - const cds: wallet.CoinWithDenom[] = [ + const cds: types.CoinWithDenom[] = [ fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), ]; - const res = wallet.selectPayCoins(cds, a("EUR:4.0"), a("EUR:0.2")); + const res = wallet.selectPayCoins([], cds, a("EUR:4.0"), a("EUR:0.2")); t.true(!res); t.pass(); }); test("coin selection 6", (t) => { - const cds: wallet.CoinWithDenom[] = [ + const cds: types.CoinWithDenom[] = [ fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), fakeCwd("EUR:1.0", "EUR:1.0", "EUR:0.5"), ]; - const res = wallet.selectPayCoins(cds, a("EUR:2.0"), a("EUR:0.2")); + const res = wallet.selectPayCoins([], cds, a("EUR:2.0"), a("EUR:0.2")); t.true(!res); t.pass(); }); |