gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: check for idempotency in tip


From: gnunet
Subject: [taler-wallet-core] branch master updated: check for idempotency in tip integration test
Date: Mon, 16 Nov 2020 14:52:28 +0100

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 768ecfc6 check for idempotency in tip integration test
768ecfc6 is described below

commit 768ecfc6008ff31cb1ac06f84dc082e2c8dac627
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Nov 16 14:52:12 2020 +0100

    check for idempotency in tip integration test
---
 .../taler-integrationtests/src/test-tipping.ts     | 46 +++++++++++++---------
 1 file changed, 27 insertions(+), 19 deletions(-)

diff --git a/packages/taler-integrationtests/src/test-tipping.ts 
b/packages/taler-integrationtests/src/test-tipping.ts
index 6703ab4b..4735de81 100644
--- a/packages/taler-integrationtests/src/test-tipping.ts
+++ b/packages/taler-integrationtests/src/test-tipping.ts
@@ -87,34 +87,42 @@ runTest(async (t: GlobalTestState) => {
 
   console.log("created tip", tip);
 
-  const ptr = await wallet.prepareTip({
-    talerTipUri: tip.taler_tip_uri,
-  });
+  const doTip = async (): Promise<void> => {
+    const ptr = await wallet.prepareTip({
+      talerTipUri: tip.taler_tip_uri,
+    });
 
-  console.log(ptr);
+    console.log(ptr);
 
-  t.assertAmountEquals(ptr.tipAmountRaw, "TESTKUDOS:5");
-  t.assertAmountEquals(ptr.tipAmountEffective, "TESTKUDOS:4.85");
+    t.assertAmountEquals(ptr.tipAmountRaw, "TESTKUDOS:5");
+    t.assertAmountEquals(ptr.tipAmountEffective, "TESTKUDOS:4.85");
 
-  await wallet.acceptTip({
-    walletTipId: ptr.walletTipId,
-  });
+    await wallet.acceptTip({
+      walletTipId: ptr.walletTipId,
+    });
 
+    await wallet.runUntilDone();
 
-  await wallet.runUntilDone();
+    const bal = await wallet.getBalances();
 
-  const bal = await wallet.getBalances();
+    console.log(bal);
 
-  console.log(bal);
+    t.assertAmountEquals(bal.balances[0].available, "TESTKUDOS:4.85");
 
-  t.assertAmountEquals(bal.balances[0].available, "TESTKUDOS:4.85");
+    const txns = await wallet.getTransactions();
 
-  const txns = await wallet.getTransactions();
+    console.log("Transactions:", JSON.stringify(txns, undefined, 2));
 
-  console.log("Transactions:", JSON.stringify(txns, undefined, 2));
+    t.assertDeepEqual(txns.transactions[0].type, "tip");
+    t.assertDeepEqual(txns.transactions[0].pending, false);
+    t.assertAmountEquals(
+      txns.transactions[0].amountEffective,
+      "TESTKUDOS:4.85",
+    );
+    t.assertAmountEquals(txns.transactions[0].amountRaw, "TESTKUDOS:5.0");
+  };
 
-  t.assertDeepEqual(txns.transactions[0].type, "tip");
-  t.assertDeepEqual(txns.transactions[0].pending, false);
-  t.assertAmountEquals(txns.transactions[0].amountEffective, "TESTKUDOS:4.85");
-  t.assertAmountEquals(txns.transactions[0].amountRaw, "TESTKUDOS:5.0");
+  // Check twice so make sure tip handling is idempotent
+  await doTip();
+  await doTip();
 });

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