diff options
author | Florian Dold <florian@dold.me> | 2022-09-16 16:20:47 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-09-16 16:32:21 +0200 |
commit | b91caf977fad8da11e523ca3a39064dd86e04c64 (patch) | |
tree | 732e1543d2555094d7f9a9ca242309847c1a33a3 /packages/taler-wallet-core/src/util/coinSelection.test.ts | |
parent | 2747bc260bc05418974570d04d7f999dfc988cda (diff) | |
download | wallet-core-b91caf977fad8da11e523ca3a39064dd86e04c64.tar.gz wallet-core-b91caf977fad8da11e523ca3a39064dd86e04c64.tar.bz2 wallet-core-b91caf977fad8da11e523ca3a39064dd86e04c64.zip |
wallet-core: support age restrictions in new coin selection
Diffstat (limited to 'packages/taler-wallet-core/src/util/coinSelection.test.ts')
-rw-r--r-- | packages/taler-wallet-core/src/util/coinSelection.test.ts | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/util/coinSelection.test.ts b/packages/taler-wallet-core/src/util/coinSelection.test.ts index 3c6ad0d82..fe9672116 100644 --- a/packages/taler-wallet-core/src/util/coinSelection.test.ts +++ b/packages/taler-wallet-core/src/util/coinSelection.test.ts @@ -18,7 +18,12 @@ * Imports. */ import test from "ava"; -import { AmountJson, Amounts, DenomKeyType } from "@gnu-taler/taler-util"; +import { + AgeRestriction, + AmountJson, + Amounts, + DenomKeyType, +} from "@gnu-taler/taler-util"; import { AvailableCoinInfo, selectPayCoinsLegacy } from "./coinSelection.js"; function a(x: string): AmountJson { @@ -41,10 +46,14 @@ function fakeAci(current: string, feeDeposit: string): AvailableCoinInfo { }, feeDeposit: a(feeDeposit), exchangeBaseUrl: "https://example.com/", + maxAge: AgeRestriction.AGE_UNRESTRICTED, }; } -function fakeAciWithAgeRestriction(current: string, feeDeposit: string): AvailableCoinInfo { +function fakeAciWithAgeRestriction( + current: string, + feeDeposit: string, +): AvailableCoinInfo { return { value: a(current), availableAmount: a(current), @@ -56,6 +65,7 @@ function fakeAciWithAgeRestriction(current: string, feeDeposit: string): Availab }, feeDeposit: a(feeDeposit), exchangeBaseUrl: "https://example.com/", + maxAge: AgeRestriction.AGE_UNRESTRICTED, }; } @@ -284,7 +294,6 @@ test("coin selection 9", (t) => { t.pass(); }); - test("it should be able to use unrestricted coins for age restricted contract", (t) => { const acis: AvailableCoinInfo[] = [ fakeAciWithAgeRestriction("EUR:1.0", "EUR:0.2"), @@ -299,7 +308,7 @@ test("it should be able to use unrestricted coins for age restricted contract", depositFeeLimit: a("EUR:0.4"), wireFeeLimit: a("EUR:0"), wireFeeAmortization: 1, - requiredMinimumAge: 13 + requiredMinimumAge: 13, }); if (!res) { t.fail(); |