aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts58
1 files changed, 35 insertions, 23 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
index 602b6629a..420e4fddc 100644
--- a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
+++ b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
@@ -32,14 +32,16 @@ import {
BankService,
ExchangeService,
GlobalTestState,
- MerchantPrivateApi,
MerchantService,
setupDb,
- WalletCli,
getPayto,
+ MerchantApiClient,
} from "../harness/harness.js";
-import { applyTimeTravelV2, createWalletDaemonWithClient, withdrawViaBankV2 } from "../harness/helpers.js";
-
+import {
+ applyTimeTravelV2,
+ createWalletDaemonWithClient,
+ withdrawViaBankV2,
+} from "../harness/helpers.js";
/**
* Basic time travel test.
@@ -110,19 +112,29 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) {
name: "w1",
});
+ const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl());
+
// Withdraw digital cash into the wallet.
- const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:15" });
+ const wres = await withdrawViaBankV2(t, {
+ walletClient,
+ bank,
+ exchange,
+ amount: "TESTKUDOS:15",
+ });
await wres.withdrawalFinishedCond;
// Travel into the future, the deposit expiration is two years
// into the future.
console.log("applying first time travel");
- await applyTimeTravelV2(Duration.toMilliseconds(durationFromSpec({ days: 400 })), {
- walletClient,
- exchange,
- merchant,
- });
+ await applyTimeTravelV2(
+ Duration.toMilliseconds(durationFromSpec({ days: 400 })),
+ {
+ walletClient,
+ exchange,
+ merchant,
+ },
+ );
await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
@@ -144,11 +156,14 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) {
// Travel into the future, the deposit expiration is two years
// into the future.
console.log("applying second time travel");
- await applyTimeTravelV2(Duration.toMilliseconds(durationFromSpec({ years: 2, months: 6 })), {
- walletClient,
- exchange,
- merchant,
- });
+ await applyTimeTravelV2(
+ Duration.toMilliseconds(durationFromSpec({ years: 2, months: 6 })),
+ {
+ walletClient,
+ exchange,
+ merchant,
+ },
+ );
// At this point, the original coins should've been refreshed.
// It would be too late to refresh them now, as we're past
@@ -156,7 +171,7 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) {
await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
- const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", {
+ const orderResp = await merchantClient.createOrder({
order: {
fulfillment_url: "http://example.com",
summary: "foo",
@@ -164,13 +179,10 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) {
},
});
- const orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(
- merchant,
- {
- orderId: orderResp.order_id,
- instance: "default",
- },
- );
+ const orderStatus = await merchantClient.queryPrivateOrderStatus({
+ orderId: orderResp.order_id,
+ instance: "default",
+ });
t.assertTrue(orderStatus.order_status === "unpaid");