taler-typescript-core

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

commit 62576c44f0dc06710fb20375db3ccf963d78f180
parent 3e7b0a0a1d5136a70046c3fde881d16a2e713797
Author: Florian Dold <dold@taler.net>
Date:   Sun,  6 Sep 2026 12:41:06 +0200

harness: compare stable balances and current wallet API results

Exclude asynchronous renewal metadata from time-travel balance equality.
Check confirmed and settled withdrawal amounts separately, and expect
the current error codes for invalid peer-push and deposit requests.

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-deposit-too-large.ts | 2+-
Mpackages/taler-harness/src/integrationtests/test-exchange-denom-storage.ts | 7++++++-
Mpackages/taler-harness/src/integrationtests/test-exchange-keys-cherrypick.ts | 7++++++-
Mpackages/taler-harness/src/integrationtests/test-peer-push.ts | 16++++++++++------
Mpackages/taler-harness/src/integrationtests/test-withdrawal-amount.ts | 3++-
5 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-deposit-too-large.ts b/packages/taler-harness/src/integrationtests/test-deposit-too-large.ts @@ -137,7 +137,7 @@ export async function runDepositTooLargeTest(t: GlobalTestState) { ); t.assertDeepEqual( oversizedError.errorDetail.code, - TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR, + TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR, ); t.assertDeepEqual( (oversizedError.errorDetail as any).httpStatusCode, diff --git a/packages/taler-harness/src/integrationtests/test-exchange-denom-storage.ts b/packages/taler-harness/src/integrationtests/test-exchange-denom-storage.ts @@ -113,7 +113,12 @@ export async function runExchangeDenomStorageTest( WalletApiOperation.GetBalances, {}, ); - t.assertDeepEqual(balanceAfter, balanceBefore); + // Refresh estimates can change as keys are verified and time advances. + // Compare the monetary balance and scope without that background status. + t.assertDeepEqual( + balanceAfter.balances.map(({ refreshInfo, ...balance }) => balance), + balanceBefore.balances.map(({ refreshInfo, ...balance }) => balance), + ); const txs = await walletClient.call(WalletApiOperation.GetTransactions, { sort: "stable-ascending", diff --git a/packages/taler-harness/src/integrationtests/test-exchange-keys-cherrypick.ts b/packages/taler-harness/src/integrationtests/test-exchange-keys-cherrypick.ts @@ -290,7 +290,12 @@ export async function runExchangeKeysCherrypickTest( WalletApiOperation.GetBalances, {}, ); - t.assertDeepEqual(balanceAfter, balanceBefore); + // Refresh estimates can change as keys are verified and time advances. + // Compare the monetary balance and scope without that background status. + t.assertDeepEqual( + balanceAfter.balances.map(({ refreshInfo, ...balance }) => balance), + balanceBefore.balances.map(({ refreshInfo, ...balance }) => balance), + ); const txs = await walletClient.call(WalletApiOperation.GetTransactions, { sort: "stable-ascending", diff --git a/packages/taler-harness/src/integrationtests/test-peer-push.ts b/packages/taler-harness/src/integrationtests/test-peer-push.ts @@ -114,14 +114,11 @@ export async function runPeerPushTest(t: GlobalTestState) { t.logStep("P2P push amount logic"); { - const [maxpeer, checkzero, checkfive] = await Promise.all([ + const [maxpeer, checkfive] = await Promise.all([ wallet1.call(WalletApiOperation.GetMaxPeerPushDebitAmount, { currency: "TESTKUDOS", }), wallet1.call(WalletApiOperation.CheckPeerPushDebit, { - amount: "TESTKUDOS:0", - }), - wallet1.call(WalletApiOperation.CheckPeerPushDebit, { amount: "TESTKUDOS:5", }), ]); @@ -130,8 +127,15 @@ export async function runPeerPushTest(t: GlobalTestState) { t.assertAmountEquals(maxpeer.rawAmount, "TESTKUDOS:199.43"); t.assertAmountEquals(maxpeer.effectiveAmount, "TESTKUDOS:199.71"); - t.assertAmountEquals(checkzero.amountRaw, "TESTKUDOS:0"); - t.assertAmountEquals(checkzero.amountEffective, "TESTKUDOS:0"); + const zeroAmountError = await t.assertThrowsTalerErrorAsync(() => + wallet1.call(WalletApiOperation.CheckPeerPushDebit, { + amount: "TESTKUDOS:0", + }), + ); + t.assertDeepEqual( + zeroAmountError.errorDetail.code, + TalerErrorCode.WALLET_CORE_API_BAD_REQUEST, + ); t.assertAmountEquals(checkfive.amountRaw, "TESTKUDOS:5"); t.assertAmountEquals(checkfive.amountEffective, "TESTKUDOS:5.16"); diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-amount.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-amount.ts @@ -107,7 +107,8 @@ export async function runWithdrawalAmountTest(t: GlobalTestState) { ); t.assertTrue(completedTx.type === TransactionType.Withdrawal); t.assertAmountEquals(completedTx.amountRaw, "TESTKUDOS:5"); - t.assertAmountEquals(completedTx.amountEffective, "TESTKUDOS:5"); + t.assertAmountEquals(completedTx.amountEffective, "TESTKUDOS:10"); + t.assertAmountEquals(completedTx.amountEffectiveFinal!, "TESTKUDOS:5"); await t.shutdown(); }