gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: time travel adding coins up w


From: gnunet
Subject: [taler-wallet-core] branch master updated: time travel adding coins up without removing old
Date: Fri, 31 May 2024 17:31:27 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 5863d8d87 time travel adding coins up without removing old
5863d8d87 is described below

commit 5863d8d877b5d838344e214ba5aeb5e893b7bb1a
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri May 31 12:31:21 2024 -0300

    time travel adding coins up without removing old
---
 .../test-timetravel-autorefresh.ts                 | 52 +++++++++++++++++++---
 1 file changed, 46 insertions(+), 6 deletions(-)

diff --git 
a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts 
b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
index e6c84b75d..8b8b45c40 100644
--- a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
+++ b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts
@@ -18,17 +18,19 @@
  * Imports.
  */
 import {
+  Amounts,
   ConfirmPayResultType,
   Duration,
   MerchantApiClient,
   NotificationType,
   PreparePayResultType,
   TalerCorebankApiClient,
+  j2s,
 } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { makeNoFeeCoinConfig } from "../harness/denomStructures.js";
 import {
-    BankService,
+  BankService,
   ExchangeService,
   GlobalTestState,
   MerchantService,
@@ -78,7 +80,10 @@ export async function runTimetravelAutorefreshTest(t: 
GlobalTestState) {
   await exchange.addBankAccount("1", {
     accountName: exchangeBankUsername,
     accountPassword: exchangeBankPassword,
-    wireGatewayApiBaseUrl: new URL("accounts/exchange/taler-wire-gateway/", 
bank.baseUrl).href,
+    wireGatewayApiBaseUrl: new URL(
+      "accounts/exchange/taler-wire-gateway/",
+      bank.baseUrl,
+    ).href,
     accountPaytoUri: exchangePaytoUri,
   });
 
@@ -133,14 +138,17 @@ export async function runTimetravelAutorefreshTest(t: 
GlobalTestState) {
 
   const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl());
 
-  // Withdraw digital cash into the wallet.
+  t.logStep("exchangeUpdated1Cond");
 
+  // Withdraw digital cash into the wallet.
+  t.logStep("Withdraw digital cash into the wallet.");
   const wres = await withdrawViaBankV3(t, {
     walletClient,
     bankClient,
     exchange,
     amount: "TESTKUDOS:15",
   });
+  t.logStep("wait");
   await wres.withdrawalFinishedCond;
 
   const exchangeUpdated1Cond = walletClient.waitForNotificationCond(
@@ -148,10 +156,18 @@ export async function runTimetravelAutorefreshTest(t: 
GlobalTestState) {
       x.type === NotificationType.ExchangeStateTransition &&
       x.exchangeBaseUrl === exchange.baseUrl,
   );
+  t.logStep("waiting tx");
+  await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
+  {
+    const balance = await walletClient.call(WalletApiOperation.GetBalances, 
{});
+    t.assertTrue(
+      Amounts.cmp(balance.balances[0].available, "TESTKUDOS:15") === 0,
+    );
+  }
 
   // Travel into the future, the deposit expiration is two years
   // into the future.
-  console.log("applying first time travel");
+  t.logStep("applying first time travel");
   await applyTimeTravelV2(
     Duration.toMilliseconds(Duration.fromSpec({ days: 400 })),
     {
@@ -162,9 +178,18 @@ export async function runTimetravelAutorefreshTest(t: 
GlobalTestState) {
   );
 
   // The time travel should cause exchanges to update.
+  t.logStep("The time travel should cause exchanges to update");
   await exchangeUpdated1Cond;
+  t.logStep("exchange updated, wahting tx");
   await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
-
+  {
+    const balance = await walletClient.call(WalletApiOperation.GetBalances, 
{});
+    t.assertTrue(
+      Amounts.cmp(balance.balances[0].available, "TESTKUDOS:15") === 0,
+    );
+  }
+
+  t.logStep("withdrawing second time");
   const wres2 = await withdrawViaBankV3(t, {
     walletClient,
     bankClient,
@@ -173,8 +198,16 @@ export async function runTimetravelAutorefreshTest(t: 
GlobalTestState) {
   });
   await wres2.withdrawalFinishedCond;
 
+  t.logStep("witdrawn, waiting tx");
   await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
 
+  {
+    const balance = await walletClient.call(WalletApiOperation.GetBalances, 
{});
+    t.assertTrue(
+      Amounts.cmp(balance.balances[0].available, "TESTKUDOS:35") === 0,
+    );
+  }
+
   const exchangeUpdated2Cond = walletClient.waitForNotificationCond(
     (x) =>
       x.type === NotificationType.ExchangeStateTransition &&
@@ -183,7 +216,7 @@ 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");
+  t.logStep("applying second time travel");
   await applyTimeTravelV2(
     Duration.toMilliseconds(Duration.fromSpec({ years: 2, months: 6 })),
     {
@@ -194,8 +227,15 @@ export async function runTimetravelAutorefreshTest(t: 
GlobalTestState) {
   );
 
   // The time travel should cause exchanges to update.
+  t.logStep("The time travel should cause exchanges to update.");
   await exchangeUpdated2Cond;
   await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
+  {
+    const balance = await walletClient.call(WalletApiOperation.GetBalances, 
{});
+    t.assertTrue(
+      Amounts.cmp(balance.balances[0].available, "TESTKUDOS:35") === 0,
+    );
+  }
 
   // At this point, the original coins should've been refreshed.
   // It would be too late to refresh them now, as we're past

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]