taler-typescript-core

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

commit b9e219c02127ec789ae44268d6e9d66ae07e2f83
parent 47f61c1ba38453ddd28abc196b7164d2ffdb1c8a
Author: Florian Dold <florian@dold.me>
Date:   Mon, 22 Jan 2024 21:59:01 +0100

harness: fix payment-share integration test

The test didn't wait for refreshes to settle before doing balance checks

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-payment-share.ts | 21+++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-payment-share.ts b/packages/taler-harness/src/integrationtests/test-payment-share.ts @@ -104,7 +104,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { claimFirstWallet.status === PreparePayResultType.PaymentPossible, ); - //share order from the first wallet + // share order from the first wallet const { privatePayUri } = await firstWallet.call( WalletApiOperation.SharePayment, { @@ -113,7 +113,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { }, ); - //claim from the second wallet + // claim from the second wallet const claimSecondWallet = await secondWallet.call( WalletApiOperation.PreparePayForUri, { talerPayUri: privatePayUri }, @@ -123,11 +123,17 @@ export async function runPaymentShareTest(t: GlobalTestState) { claimSecondWallet.status === PreparePayResultType.PaymentPossible, ); - //pay from the second wallet + // pay from the second wallet const r2 = await secondWallet.call(WalletApiOperation.ConfirmPay, { proposalId: claimSecondWallet.proposalId, }); + // Wait for refresh to settle before we do checks + await secondWallet.call( + WalletApiOperation.TestingWaitTransactionsFinal, + {}, + ); + t.assertTrue(r2.type === ConfirmPayResultType.Done); { const first = await firstWallet.call(WalletApiOperation.GetBalances, {}); @@ -181,7 +187,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { claimFirstWallet.status === PreparePayResultType.PaymentPossible, ); - //share order from the first wallet + // share order from the first wallet const { privatePayUri } = await firstWallet.call( WalletApiOperation.SharePayment, { @@ -190,7 +196,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { }, ); - //claim from the second wallet + // claim from the second wallet const claimSecondWallet = await secondWallet.call( WalletApiOperation.PreparePayForUri, { talerPayUri: privatePayUri }, @@ -200,13 +206,16 @@ export async function runPaymentShareTest(t: GlobalTestState) { claimSecondWallet.status === PreparePayResultType.PaymentPossible, ); - //pay from the second wallet + // pay from the second wallet const r2 = await firstWallet.call(WalletApiOperation.ConfirmPay, { proposalId: claimFirstWallet.proposalId, }); t.assertTrue(r2.type === ConfirmPayResultType.Done); + // Wait for refreshes to settle before doing checks + await firstWallet.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); + const bal1 = await firstWallet.call(WalletApiOperation.GetBalances, {}); t.assertAmountEquals(bal1.balances[0].available, "TESTKUDOS:16.18");