taler-typescript-core

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

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

harness: wait for the requested wallet state

Use state-aware waits to avoid missing an already emitted readiness
notification or accepting one for a different exchange.

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-wallet-exchange-update.ts | 15++++-----------
Mpackages/taler-harness/src/integrationtests/test-wallet-gendb.ts | 17+++++++----------
2 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-wallet-exchange-update.ts b/packages/taler-harness/src/integrationtests/test-wallet-exchange-update.ts @@ -21,8 +21,6 @@ import { AmountString, Amounts, BasicAuth, - ExchangeUpdateStatus, - NotificationType, TalerCorebankApiClient, j2s, } from "@gnu-taler/taler-util"; @@ -210,14 +208,6 @@ export async function runWalletExchangeUpdateTest( }); }); - const exchangeAvailableCond = walletClient.waitForNotificationCond((n) => { - console.log(`got notif ${j2s(n)}`); - return ( - n.type === NotificationType.ExchangeStateTransition && - n.newExchangeState?.exchangeUpdateStatus === ExchangeUpdateStatus.Ready - ); - }); - await exchangeTwo.stop(); console.log("starting first exchange"); @@ -231,7 +221,10 @@ export async function runWalletExchangeUpdateTest( force: true, }); - await exchangeAvailableCond; + await walletClient.call(WalletApiOperation.TestingWaitExchangeReady, { + exchangeBaseUrl: exchangeOne.baseUrl, + forceUpdate: true, + }); // Going back to the key the coins were issued under is not a new change to // confirm: the wallet is where it started, so the warning clears and the diff --git a/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts b/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts @@ -21,7 +21,6 @@ import { AbsoluteTime, AmountString, Duration, - NotificationType, TalerMerchantApi, TransactionMajorState, TransactionMinorState, @@ -94,15 +93,13 @@ export async function runWalletGenDbTest(t: GlobalTestState) { }, ); - const peerPullCreditReadyCond = walletClient.waitForNotificationCond( - (x) => - x.type === NotificationType.TransactionStateTransition && - x.transactionId === peerPullIniResp.transactionId && - x.newTxState.major === TransactionMajorState.Pending && - x.newTxState.minor === TransactionMinorState.Ready, - ); - - await peerPullCreditReadyCond; + await walletClient.call(WalletApiOperation.TestingWaitTransactionState, { + transactionId: peerPullIniResp.transactionId, + txState: { + major: TransactionMajorState.Pending, + minor: TransactionMinorState.Ready, + }, + }); const checkResp = await walletClient.call( WalletApiOperation.PreparePeerPullDebit,