gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant-backoffice] 11/11: bank: test withdrawal abort


From: gnunet
Subject: [taler-merchant-backoffice] 11/11: bank: test withdrawal abort
Date: Mon, 20 Dec 2021 17:45:09 +0100

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

ms pushed a commit to branch master
in repository merchant-backoffice.

commit 8003d414e0a2013e0491e8d33801a2c7db27c39b
Author: ms <ms@taler.net>
AuthorDate: Mon Dec 20 11:16:40 2021 +0100

    bank: test withdrawal abort
---
 packages/bank/tests/__tests__/homepage.js | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/packages/bank/tests/__tests__/homepage.js 
b/packages/bank/tests/__tests__/homepage.js
index d15433e..c3d370e 100644
--- a/packages/bank/tests/__tests__/homepage.js
+++ b/packages/bank/tests/__tests__/homepage.js
@@ -83,6 +83,28 @@ describe("withdraw", () => {
     await screen.findByText("gave response error", {exact: false})
   })
 
+  test("Abort withdrawal", async () => {
+    let withdrawButton = screen.getByText("Charge Taler wallet");
+    fetch.once(JSON.stringify({
+      taler_withdraw_uri: "taler://withdraw/foo",
+      withdrawal_id: "foo"
+    }));
+    /**
+     * After triggering a withdrawal, check if the taler://withdraw URI
+     * rendered, and confirm if so.  Lastly, check that a success message
+     * appeared on the screen.
+     */
+    fireEvent.click(withdrawButton);
+    const abortButton = await screen.findByText("abort withdrawal", {exact: 
false})
+    fireEvent.click(abortButton);
+    expect(fetch).toHaveBeenLastCalledWith(
+    
`http://localhost/demobanks/default/access-api/accounts/${context.username}/withdrawals/foo/abort`,
+    expect.anything()
+    )
+    await waitFor(() => expect(
+      screen.queryByText("abort withdrawal", {exact: 
false})).not.toBeInTheDocument());
+  })
+
   test("Successful withdrawal creation and confirmation", async () => {
     let withdrawButton = screen.getByText("Charge Taler wallet");
     fetch.once(JSON.stringify({
@@ -103,10 +125,7 @@ describe("withdraw", () => {
     // assume wallet POSTed the payment details.
     const confirmButton = await screen.findByText("confirm withdrawal", 
{exact: false})
     await waitFor(() => expect(
-      screen.queryByText(
-        "charge taler wallet",
-        {exact: false})).not.toBeInTheDocument()
-    );
+      screen.queryByText("charge taler wallet", {exact: 
false})).not.toBeInTheDocument());
     fetch.once("{}")
     fireEvent.click(confirmButton);
     /**
@@ -124,6 +143,9 @@ describe("withdraw", () => {
         "give this address to the taler wallet",
         {exact: false})).not.toBeInTheDocument()
     );
+    expect(fetch).toHaveBeenLastCalledWith(
+    
`http://localhost/demobanks/default/access-api/accounts/${context.username}/withdrawals/foo/confirm`,
+    expect.anything())
     // success message
     await screen.findByText("withdrawal confirmed", {exact: false})
 

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