gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: add test to compare withdrawi


From: gnunet
Subject: [taler-wallet-core] branch master updated: add test to compare withdrawing KUDOS:25 with demo config
Date: Fri, 16 Jun 2023 14:50:26 +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 ed01d407e add test to compare withdrawing KUDOS:25 with demo config
ed01d407e is described below

commit ed01d407e7e224960337614385676dcf1ae6ca8d
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Jun 16 09:50:19 2023 -0300

    add test to compare withdrawing KUDOS:25 with demo config
---
 .../src/util/coinSelection.test.ts                 | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/packages/taler-wallet-core/src/util/coinSelection.test.ts 
b/packages/taler-wallet-core/src/util/coinSelection.test.ts
index 448982c7f..ab3b2c4f8 100644
--- a/packages/taler-wallet-core/src/util/coinSelection.test.ts
+++ b/packages/taler-wallet-core/src/util/coinSelection.test.ts
@@ -102,6 +102,28 @@ test("get raw 4", (t) => {
   t.assert(result.refresh === undefined);
 });
 
+test("get raw 25, diff with demo ", (t) => {
+  const coinList: Coin[] = [
+    [kudos(0.1), 0],
+    [kudos(1), 0],
+    [kudos(2), 0],
+    [kudos(5), 0],
+    [kudos(10), 0],
+  ];
+  const result = selectCoinForOperation(
+    OperationType.Credit,
+    kudos(25),
+    AmountMode.Gross,
+    {
+      list: coinList.map(([v, t]) => defaultFeeConfig(v, t)),
+      exchanges: {},
+    },
+  );
+
+  expect(t, result.coins).deep.equal(["KUDOS:10", "KUDOS:10", "KUDOS:5"]);
+  t.assert(result.refresh === undefined);
+});
+
 test("send effective 6", (t) => {
   const coinList: Coin[] = [
     [kudos(2), 5],
@@ -246,3 +268,34 @@ test("withdraw raw 21 ", (t) => {
   t.deepEqual(result.rawAmount, "KUDOS:20");
   t.deepEqual(result.effectiveAmount, "KUDOS:19.96");
 });
+
+test("withdraw raw 25, diff with demo ", (t) => {
+  const coinList: Coin[] = [
+    [kudos(0.1), 0],
+    [kudos(1), 0],
+    [kudos(2), 0],
+    [kudos(5), 0],
+    [kudos(10), 0],
+  ];
+  const result = calculatePlanFormAvailableCoins(
+    TransactionType.Withdrawal,
+    kudos(25),
+    TransactionAmountMode.Raw,
+    {
+      list: coinList.map(([v, t]) => defaultFeeConfig(v, t)),
+      exchanges: {
+        "2": {
+          creditDeadline: AbsoluteTime.never(),
+          debitDeadline: AbsoluteTime.never(),
+          wireFee: kudos(0.01),
+          purseFee: kudos(0.01),
+        },
+      },
+    },
+  );
+
+  t.deepEqual(result.rawAmount, "KUDOS:25");
+  // here demo report KUDOS:0.2 fee
+  // t.deepEqual(result.effectiveAmount, "KUDOS:24.80");
+  t.deepEqual(result.effectiveAmount, "KUDOS:24.97");
+});

-- 
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]