[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: harness: check expected balan
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: harness: check expected balance in test-pay-expired |
Date: |
Tue, 05 Sep 2023 11:35:06 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 49b0f5337 harness: check expected balance in test-pay-expired
49b0f5337 is described below
commit 49b0f5337c27c5da3e85c512de72e6903e928bc8
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Sep 5 11:35:06 2023 +0200
harness: check expected balance in test-pay-expired
---
packages/taler-harness/src/harness/harness.ts | 6 ++++-
packages/taler-harness/src/harness/helpers.ts | 2 +-
.../src/integrationtests/test-payment-expired.ts | 30 ++++++++++++++++++++++
packages/taler-wallet-core/src/remote.ts | 1 +
packages/taler-wallet-core/src/wallet.ts | 1 +
5 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/packages/taler-harness/src/harness/harness.ts
b/packages/taler-harness/src/harness/harness.ts
index b5197afd7..7c54c0c47 100644
--- a/packages/taler-harness/src/harness/harness.ts
+++ b/packages/taler-harness/src/harness/harness.ts
@@ -384,7 +384,11 @@ export class GlobalTestState {
logger.warn(`could not start process (${command})`, err);
});
proc.on("exit", (code, signal) => {
- logger.warn(`process ${logName} exited ${j2s({ code, signal })}`);
+ if (code == 0 && signal == null) {
+ logger.info(`process ${logName} exited with success`);
+ } else {
+ logger.warn(`process ${logName} exited ${j2s({ code, signal })}`);
+ }
});
const stderrLogFileName = this.testDir + `/${logName}-stderr.log`;
const stderrLog = fs.createWriteStream(stderrLogFileName, {
diff --git a/packages/taler-harness/src/harness/helpers.ts
b/packages/taler-harness/src/harness/helpers.ts
index 39d411a46..ece003e1b 100644
--- a/packages/taler-harness/src/harness/helpers.ts
+++ b/packages/taler-harness/src/harness/helpers.ts
@@ -624,7 +624,7 @@ export async function applyTimeTravelV2(
}
if (s.walletClient) {
- s.walletClient.call(WalletApiOperation.TestingSetTimetravel, {
+ await s.walletClient.call(WalletApiOperation.TestingSetTimetravel, {
offsetMs: timetravelOffsetMs,
});
}
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"];
diff --git a/packages/taler-wallet-core/src/remote.ts
b/packages/taler-wallet-core/src/remote.ts
index 89348698e..164f7cfe9 100644
--- a/packages/taler-wallet-core/src/remote.ts
+++ b/packages/taler-wallet-core/src/remote.ts
@@ -65,6 +65,7 @@ export async function createRemoteWallet(
const ctx: RemoteWallet = {
makeCoreApiRequest(operation, payload) {
const id = `req-${nextRequestId}`;
+ nextRequestId += 1;
const req: CoreApiRequestEnvelope = {
operation,
id,
diff --git a/packages/taler-wallet-core/src/wallet.ts
b/packages/taler-wallet-core/src/wallet.ts
index 4194ab9eb..f42365c00 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -1680,6 +1680,7 @@ async function dispatchRequestInternal<Op extends
WalletApiOperation>(
const req = codecForTestingSetTimetravelRequest().decode(payload);
setDangerousTimetravel(req.offsetMs);
ws.workAvailable.trigger();
+ return {};
}
// default:
// assertUnreachable(operation);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: harness: check expected balance in test-pay-expired,
gnunet <=