aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-02-13 10:53:43 +0100
committerFlorian Dold <florian@dold.me>2024-02-15 21:56:54 +0100
commit70a803038f1cbe05dc4779bdd87376fd073421be (patch)
tree6607d69f6906ada9f912e31d9a9e3b65560a7326 /packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
parent2c17e98c336d96f955ec82ad0a1b164e3da90103 (diff)
downloadwallet-core-70a803038f1cbe05dc4779bdd87376fd073421be.tar.xz
implement task shepherd, many small fixes and tweaks
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
index def2462e0..3c47f30db 100644
--- a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
+++ b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
@@ -22,6 +22,7 @@ import {
Duration,
durationFromSpec,
MerchantApiClient,
+ NotificationType,
PreparePayResultType,
} from "@gnu-taler/taler-util";
import {
@@ -124,6 +125,12 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) {
});
await wres.withdrawalFinishedCond;
+ const exchangeUpdated1Cond = walletClient.waitForNotificationCond(
+ (x) =>
+ x.type === NotificationType.ExchangeStateTransition &&
+ x.exchangeBaseUrl === exchange.baseUrl,
+ );
+
// Travel into the future, the deposit expiration is two years
// into the future.
console.log("applying first time travel");
@@ -142,7 +149,8 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) {
console.log("pending operations after first time travel");
console.log(JSON.stringify(p, undefined, 2));
- await walletClient.call(WalletApiOperation.TestingWaitTasksProcessed, {});
+ // The time travel should cause exchanges to update.
+ await exchangeUpdated1Cond;
await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
const wres2 = await withdrawViaBankV2(t, {
@@ -155,6 +163,12 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) {
await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
+ const exchangeUpdated2Cond = walletClient.waitForNotificationCond(
+ (x) =>
+ x.type === NotificationType.ExchangeStateTransition &&
+ x.exchangeBaseUrl === exchange.baseUrl,
+ );
+
// Travel into the future, the deposit expiration is two years
// into the future.
console.log("applying second time travel");
@@ -167,7 +181,8 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) {
},
);
- await walletClient.call(WalletApiOperation.TestingWaitTasksProcessed, {});
+ // The time travel should cause exchanges to update.
+ await exchangeUpdated2Cond;
await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
// At this point, the original coins should've been refreshed.