diff options
author | Florian Dold <florian@dold.me> | 2023-09-05 11:35:06 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-09-05 11:35:06 +0200 |
commit | 49b0f5337c27c5da3e85c512de72e6903e928bc8 (patch) | |
tree | ff979ed992c0fcea501f2d45b2bbed21f951b0b6 /packages/taler-harness/src/integrationtests | |
parent | a3f370b0d83030e1a265374fd23371b000ada1c9 (diff) | |
download | wallet-core-49b0f5337c27c5da3e85c512de72e6903e928bc8.tar.xz |
harness: check expected balance in test-pay-expired
Diffstat (limited to 'packages/taler-harness/src/integrationtests')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-payment-expired.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-payment-expired.ts b/packages/taler-harness/src/integrationtests/test-payment-expired.ts index e4034108f..4817efba5 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-expired.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-expired.ts @@ -20,14 +20,17 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, MerchantApiClient } from "../harness/harness.js"; import { + applyTimeTravelV2, createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, } from "../harness/helpers.js"; import { AbsoluteTime, + ConfirmPayResultType, Duration, MerchantContractTerms, PreparePayResultType, + j2s, } from "@gnu-taler/taler-util"; /** @@ -95,6 +98,33 @@ export async function runPaymentExpiredTest(t: GlobalTestState) { preparePayResult.status, PreparePayResultType.PaymentPossible, ); + + await applyTimeTravelV2( + Duration.toMilliseconds(Duration.fromSpec({ hours: 1 })), + { walletClient, exchange, merchant }, + ); + + const confirmPayResult = await walletClient.call( + WalletApiOperation.ConfirmPay, + { transactionId: preparePayResult.transactionId }, + ); + console.log("confirm pay result:"); + console.log(j2s(confirmPayResult)); + t.assertDeepEqual(confirmPayResult.type, ConfirmPayResultType.Pending); + await walletClient.call(WalletApiOperation.AbortTransaction, { + transactionId: preparePayResult.transactionId, + }); + await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); + + const bal = await walletClient.call(WalletApiOperation.GetBalances, {}); + console.log(bal); + + t.assertAmountEquals(bal.balances[0].available, "TESTKUDOS:18.93"); + + const txns = await walletClient.call(WalletApiOperation.GetTransactions, { + includeRefreshes: true, + }); + console.log(j2s(txns)); } runPaymentExpiredTest.suites = ["wallet"]; |