diff options
author | Florian Dold <florian@dold.me> | 2023-02-14 11:16:58 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-02-14 11:17:19 +0100 |
commit | 6a4da88719bc7a1506433c1117b2402d2bd48f36 (patch) | |
tree | 7094aed1a6a8e1fe85854225c8744c955d7d973c /packages/taler-harness/src/integrationtests/test-refund.ts | |
parent | 6106caeba9e017242dfd334c34c8473aefb6ffb0 (diff) | |
download | wallet-core-6a4da88719bc7a1506433c1117b2402d2bd48f36.tar.xz |
wallet-core: expose more info about refund query
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-refund.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-refund.ts | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-refund.ts b/packages/taler-harness/src/integrationtests/test-refund.ts index 93850769a..4ae45b8bf 100644 --- a/packages/taler-harness/src/integrationtests/test-refund.ts +++ b/packages/taler-harness/src/integrationtests/test-refund.ts @@ -17,12 +17,16 @@ /** * Imports. */ -import { Duration, durationFromSpec } from "@gnu-taler/taler-util"; +import { + Duration, + durationFromSpec, + NotificationType, +} from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironment, - withdrawViaBank, + createSimpleTestkudosEnvironmentV2, + withdrawViaBankV2, } from "../harness/helpers.js"; /** @@ -31,12 +35,23 @@ import { export async function runRefundTest(t: GlobalTestState) { // Set up test environment - const { wallet, bank, exchange, merchant } = - await createSimpleTestkudosEnvironment(t); + const { + walletClient: wallet, + bank, + exchange, + merchant, + } = await createSimpleTestkudosEnvironmentV2(t); // Withdraw digital cash into the wallet. - await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" }); + const withdrawalRes = await withdrawViaBankV2(t, { + walletClient: wallet, + bank, + exchange, + amount: "TESTKUDOS:20", + }); + + await withdrawalRes.withdrawalFinishedCond; // Set up order. @@ -85,12 +100,15 @@ export async function runRefundTest(t: GlobalTestState) { console.log(ref); { + const refundFinishedCond = wallet.waitForNotificationCond( + (x) => x.type === NotificationType.RefundFinished, + ); const r = await wallet.client.call(WalletApiOperation.ApplyRefund, { talerRefundUri: ref.talerRefundUri, }); console.log(r); - await wallet.runUntilDone(); + await refundFinishedCond; } { @@ -103,6 +121,9 @@ export async function runRefundTest(t: GlobalTestState) { } { + const refundQueriedCond = wallet.waitForNotificationCond( + (x) => x.type === NotificationType.RefundQueried, + ); const r3 = await wallet.client.call( WalletApiOperation.ApplyRefundFromPurchaseId, { @@ -110,11 +131,8 @@ export async function runRefundTest(t: GlobalTestState) { }, ); console.log(r3); - - await wallet.runUntilDone(); + await refundQueriedCond; } - - await t.shutdown(); } runRefundTest.suites = ["wallet"]; |