From b91caf977fad8da11e523ca3a39064dd86e04c64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 16 Sep 2022 16:20:47 +0200 Subject: wallet-core: support age restrictions in new coin selection --- .../taler-wallet-core/src/util/coinSelection.test.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'packages/taler-wallet-core/src/util/coinSelection.test.ts') 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(); -- cgit v1.2.3