commit 1a7abd292e97ffa4403e31115d751648c510cb26
parent 8746818e5b0c0ee270be25e43c3d0522093653a0
Author: ms <ms@taler.net>
Date: Thu, 13 Jan 2022 08:50:32 +0100
re-enable tests
Diffstat:
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/packages/bank/tests/__tests__/homepage.js b/packages/bank/tests/__tests__/homepage.js
@@ -194,7 +194,7 @@ describe("home page", () => {
})
test("public histories", async () => {
// Mock list of public accounts.
- fetch.mockImplementationOnce(JSON.stringify({
+ fetch.once(JSON.stringify({
"publicAccounts" : [ {
"balance" : "EUR:1",
"iban" : "XXX",
@@ -204,9 +204,7 @@ describe("home page", () => {
"iban" : "YYY",
"accountLabel" : "bar"
}]
- }))
- // Response to history request.
- fetch.mockImplementationOnce(JSON.stringify({
+ })).once(JSON.stringify({
transactions: [{
debtorIban: "XXX",
debtorBic: "YYY",
@@ -230,9 +228,7 @@ describe("home page", () => {
subject: "Bonus",
date: "2000-01-01"
}]
- }))
- // Response to history request.
- fetch.mockResponseOnce(JSON.stringify({
+ })).once(JSON.stringify({
transactions: [{
debtorIban: "XXX",
debtorBic: "YYY",
@@ -258,13 +254,21 @@ describe("home page", () => {
}]
}))
render(<BankHome />);
+ /**
+ * Check that transacions data appears on the page.
+ */
+ await screen.findByText("reimbursement", {exact: false});
+ await screen.findByText("refund", {exact: false});
+ await screen.findByText("bonus", {exact: false});
+ await screen.findByText("donation", {exact: false});
+
await expect(fetch).toHaveBeenCalledWith(
"http://localhost/demobanks/default/access-api/public-accounts"
)
- 0 && await expect(fetch).toHaveBeenCalledWith(
+ await expect(fetch).toHaveBeenCalledWith(
"http://localhost/demobanks/default/access-api/accounts/foo/transactions?page=0"
)
- 0 && await expect(fetch).toHaveBeenCalledWith(
+ await expect(fetch).toHaveBeenCalledWith(
"http://localhost/demobanks/default/access-api/accounts/bar/transactions?page=0"
)
})