[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant-backoffice] branch master updated: fix hook usage after
From: |
gnunet |
Subject: |
[taler-merchant-backoffice] branch master updated: fix hook usage after Sebastian suggestion |
Date: |
Tue, 11 Jan 2022 09:50:17 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository merchant-backoffice.
The following commit(s) were added to refs/heads/master by this push:
new 5b7326e fix hook usage after Sebastian suggestion
5b7326e is described below
commit 5b7326e69b1e2a5655e7dc4e8209e69bfb8fd997
Author: ms <ms@taler.net>
AuthorDate: Tue Jan 11 09:49:35 2022 +0100
fix hook usage after Sebastian suggestion
---
packages/bank/package.json | 1 +
packages/bank/src/pages/home/index.tsx | 19 +++++++++---------
packages/bank/tests/__tests__/homepage.js | 32 +------------------------------
3 files changed, 11 insertions(+), 41 deletions(-)
diff --git a/packages/bank/package.json b/packages/bank/package.json
index c153dd5..6f5a771 100644
--- a/packages/bank/package.json
+++ b/packages/bank/package.json
@@ -66,6 +66,7 @@
"jest-fetch-mock": "^3.0.3",
"jest-preset-preact": "^4.0.5",
"jest-watch-typeahead": "^1.0.0",
+ "jest-environment-jsdom": "^27.4.6",
"jssha": "^3.2.0",
"po2json": "^0.4.5",
"preact-cli": "3.0.5",
diff --git a/packages/bank/src/pages/home/index.tsx
b/packages/bank/src/pages/home/index.tsx
index 5401987..166579b 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -526,6 +526,15 @@ function Account(Props: any): VNode {
withdrawalOutcome,
talerWithdrawUri,
accountLabel } = Props;
+ /**
+ * This part shows a list of transactions: with 5 elements by
+ * default and offers a "load more" button.
+ */
+ var [txPageNumber, setTxPageNumber] = useTransactionPageNumber() // Buggy.
+ var txsPages = []
+ for (let i = 0; i <= txPageNumber; i++) {
+ txsPages.push(<Transactions accountLabel={Props.accountLabel}
pageNumber={txPageNumber} />)
+ }
const i18n = useTranslator();
/**
* Getting the bank account balance.
@@ -579,16 +588,6 @@ function Account(Props: any): VNode {
</Fragment>);
}
- /**
- * This part shows a list of transactions: with 5 elements by
- * default and offers a "load more" button.
- */
- var [txPageNumber, setTxPageNumber] = useTransactionPageNumber() // Buggy.
- var txsPages = []
- for (let i = 0; i <= txPageNumber; i++) {
- txsPages.push(<Transactions accountLabel={Props.accountLabel}
pageNumber={txPageNumber} />)
- }
-
return (<Fragment>
<p>Your balance is {data.balance.amount}.</p>
<div>
diff --git a/packages/bank/tests/__tests__/homepage.js
b/packages/bank/tests/__tests__/homepage.js
index f1045f1..65661a3 100644
--- a/packages/bank/tests/__tests__/homepage.js
+++ b/packages/bank/tests/__tests__/homepage.js
@@ -16,34 +16,6 @@ jest.mock("../../src/i18n")
const i18n = require("../../src/i18n")
i18n.useTranslator.mockImplementation(() => function(arg) {return arg})
-/**
- * Mocking local storage, see:
- *
https://stackoverflow.com/questions/32911630/how-do-i-deal-with-localstorage-in-jest-tests
- */
-class LocalStorageMock {
- constructor() {
- this.store = {};
- }
-
- clear() {
- this.store = {};
- }
-
- getItem(key) {
- return this.store[key] || null;
- }
-
- setItem(key, value) {
- this.store[key] = String(value);
- }
-
- removeItem(key) {
- delete this.store[key];
- }
-}
-
-global.localStotage = new LocalStorageMock();
-
beforeAll(() => {
Object.defineProperty(window, 'location', {
value: {
@@ -51,9 +23,7 @@ beforeAll(() => {
pathname: "/demobanks/default"
}
})
-})
-afterAll(() => {
- global.localStorage.clear()
+ global.Storage.prototype.setItem = jest.fn((key, value) => {})
})
/**
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant-backoffice] branch master updated: fix hook usage after Sebastian suggestion,
gnunet <=