Page MenuHomePhabricator

[Cashtab] Add support for multiple fiat currencies
ClosedPublic

Authored by bytesofman on Jul 21 2021, 14:31.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC5dea8ff63203: [Cashtab] Add support for multiple fiat currencies
Summary

MVP implementation for multiple fiat currencies. Some parts of the app had been written assuming hardcoded USD only support, and these had to be refactored.

Overview

  1. Convert fiat price API fetch from ongoing interval to named interval stored in state that can be cleared
  2. Add new settings parameter to local storage. For now, only fiat currency is here. Going forward this is extensible for other app settings.
  3. Add function changeCashtabSettings to useWallet.js to update app settings (and lock UI until update is complete)
  4. Add a select menu to Configure.js to update currencies
  5. Replace 'USD' with '!== XEC' in comparisons that were checking for fiat or crypto
Test Plan
  1. npm start
  2. Navigate to settings screen and change currency
  3. Verify that displayed balance and currency symbol have updated when navigate back to Home or Send
  4. Send a tx in a non-USD currency
  5. Switch currencies several times and verify balance and currency symbol update

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Mark snapshots as generated + remove css typo

Failed tests logs:

====== CashTab Unit Tests:  Wallet with BCH balances ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances 1`

- Snapshot  - 1
+ Received  + 1

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-gPEVay NMtXN"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
    at Object.<anonymous> (/work/web/cashtab/src/components/Wallet/__tests__/Wallet.test.js:50:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances 1`

- Snapshot  - 2
+ Received  + 2

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-jzJRlG fVAWpo"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
@@ -328,11 +328,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:69:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 1
+ Received  + 1

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-gPEVay NMtXN"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
    at Object.<anonymous> (/work/web/cashtab/src/components/Wallet/__tests__/Wallet.test.js:63:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 2
+ Received  + 2

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-jzJRlG fVAWpo"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
@@ -328,11 +328,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:83:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens and state field ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 1
+ Received  + 1

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-gPEVay NMtXN"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
    at Object.<anonymous> (/work/web/cashtab/src/components/Wallet/__tests__/Wallet.test.js:76:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 2
+ Received  + 2

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-jzJRlG fVAWpo"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
@@ -328,11 +328,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:97:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens and state field, but no params in state ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field, but no params in state 1`

- Snapshot  - 1
+ Received  + 1

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-gPEVay NMtXN"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
    at Object.<anonymous> (/work/web/cashtab/src/components/Wallet/__tests__/Wallet.test.js:89:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field, but no params in state 1`

- Snapshot  - 2
+ Received  + 2

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-jzJRlG fVAWpo"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
@@ -328,11 +328,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:111:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet without BCH balance ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet without BCH balance 1`

- Snapshot  - 1
+ Received  + 1

@@ -321,11 +321,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:55:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Without wallet defined ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Without wallet defined 1`

- Snapshot  - 1
+ Received  + 1

@@ -321,11 +321,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:129:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

Each failure log is accessible here:
CashTab Unit Tests: Wallet with BCH balances
CashTab Unit Tests: Wallet with BCH balances and tokens
CashTab Unit Tests: Wallet with BCH balances and tokens and state field
CashTab Unit Tests: Wallet with BCH balances and tokens and state field, but no params in state
CashTab Unit Tests: Wallet without BCH balance
CashTab Unit Tests: Without wallet defined

Failed tests logs:

====== CashTab Unit Tests:  Wallet with BCH balances ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances 1`

- Snapshot  - 1
+ Received  + 1

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-gPEVay NMtXN"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
    at Object.<anonymous> (/work/web/cashtab/src/components/Wallet/__tests__/Wallet.test.js:50:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances 1`

- Snapshot  - 4
+ Received  + 4

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-jzJRlG fVAWpo"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
@@ -38,11 +38,11 @@
                  "width": "auto",
                }
              }
            >
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  disabled={false}
                  style={Object {}}
@@ -150,11 +150,11 @@
                    </div>
                  </div>
                </div>
              </div>
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
@@ -328,11 +328,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:69:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 1
+ Received  + 1

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-gPEVay NMtXN"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
    at Object.<anonymous> (/work/web/cashtab/src/components/Wallet/__tests__/Wallet.test.js:63:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 2
+ Received  + 2

@@ -30,11 +30,11 @@
                  "width": "auto",
                }
              }
            >
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
@@ -140,11 +140,11 @@
                    </div>
                  </div>
                </div>
              </div>
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/SendToken.test.js:58:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 4
+ Received  + 4

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-jzJRlG fVAWpo"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
@@ -38,11 +38,11 @@
                  "width": "auto",
                }
              }
            >
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  disabled={false}
                  style={Object {}}
@@ -150,11 +150,11 @@
                    </div>
                  </div>
                </div>
              </div>
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
@@ -328,11 +328,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:83:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens and state field ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 1
+ Received  + 1

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-gPEVay NMtXN"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
    at Object.<anonymous> (/work/web/cashtab/src/components/Wallet/__tests__/Wallet.test.js:76:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 2
+ Received  + 2

@@ -30,11 +30,11 @@
                  "width": "auto",
                }
              }
            >
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
@@ -140,11 +140,11 @@
                    </div>
                  </div>
                </div>
              </div>
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/SendToken.test.js:77:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 4
+ Received  + 4

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-jzJRlG fVAWpo"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
@@ -38,11 +38,11 @@
                  "width": "auto",
                }
              }
            >
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  disabled={false}
                  style={Object {}}
@@ -150,11 +150,11 @@
                    </div>
                  </div>
                </div>
              </div>
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
@@ -328,11 +328,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:97:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens and state field, but no params in state ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field, but no params in state 1`

- Snapshot  - 1
+ Received  + 1

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-gPEVay NMtXN"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
    at Object.<anonymous> (/work/web/cashtab/src/components/Wallet/__tests__/Wallet.test.js:89:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field, but no params in state 1`

- Snapshot  - 2
+ Received  + 2

@@ -30,11 +30,11 @@
                  "width": "auto",
                }
              }
            >
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
@@ -140,11 +140,11 @@
                    </div>
                  </div>
                </div>
              </div>
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/SendToken.test.js:96:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field, but no params in state 1`

- Snapshot  - 4
+ Received  + 4

@@ -7,11 +7,11 @@
      XEC
    </div>,
    <div
      className="sc-jzJRlG fVAWpo"
    >
-     $
+     $ 
      NaN
       
      USD
    </div>,
    <div
@@ -38,11 +38,11 @@
                  "width": "auto",
                }
              }
            >
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  disabled={false}
                  style={Object {}}
@@ -150,11 +150,11 @@
                    </div>
                  </div>
                </div>
              </div>
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
@@ -328,11 +328,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:111:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Configure without a wallet ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Configure without a wallet 1`

- Snapshot  - 1
+ Received  + 1

@@ -201,11 +201,11 @@
            </svg>
          </span>
           Fiat Currency
        </h2>
        <div
-         className="sc-iwsKbI iBQLhJ"
+         className="sc-iwsKbI dmHKdG"
        >
          <div
            className="ant-select select-after ant-select-single ant-select-show-arrow"
            onBlur={[Function]}
            onFocus={[Function]}
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:24:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Configure with a wallet ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Configure with a wallet 1`

- Snapshot  - 1
+ Received  + 1

@@ -239,11 +239,11 @@
            </svg>
          </span>
           Fiat Currency
        </h2>
        <div
-         className="sc-iwsKbI iBQLhJ"
+         className="sc-iwsKbI dmHKdG"
        >
          <div
            className="ant-select select-after ant-select-single ant-select-show-arrow"
            onBlur={[Function]}
            onFocus={[Function]}
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:35:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Wallet without BCH balance ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet without BCH balance 1`

- Snapshot  - 3
+ Received  + 3

@@ -31,11 +31,11 @@
                  "width": "auto",
                }
              }
            >
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  disabled={false}
                  style={Object {}}
@@ -143,11 +143,11 @@
                    </div>
                  </div>
                </div>
              </div>
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
@@ -321,11 +321,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:55:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
====== CashTab Unit Tests:  Without wallet defined ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Without wallet defined 1`

- Snapshot  - 3
+ Received  + 3

@@ -31,11 +31,11 @@
                  "width": "auto",
                }
              }
            >
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  disabled={false}
                  style={Object {}}
@@ -143,11 +143,11 @@
                    </div>
                  </div>
                </div>
              </div>
              <div
-               className="sc-gZMcBi bKxlXN"
+               className="sc-gZMcBi bZwSTm"
              >
                <div
                  className="ant-row ant-form-item"
                  style={Object {}}
                >
@@ -321,11 +321,11 @@
              <div
                className="sc-kgoBCf kMQqjE"
              >
                =
                 
-               $ NaN USD
+               $  NaN USD
              </div>
              <div
                style={
                  Object {
                    "paddingTop": "12px",
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:129:18)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

Each failure log is accessible here:
CashTab Unit Tests: Wallet with BCH balances
CashTab Unit Tests: Wallet with BCH balances and tokens
CashTab Unit Tests: Wallet with BCH balances and tokens and state field
CashTab Unit Tests: Wallet with BCH balances and tokens and state field, but no params in state
CashTab Unit Tests: Configure without a wallet
CashTab Unit Tests: Configure with a wallet
CashTab Unit Tests: Wallet without BCH balance
CashTab Unit Tests: Without wallet defined

Updating snapshots to fix unit tests

Fabien requested changes to this revision.Jul 23 2021, 06:33
Fabien added a subscriber: Fabien.

The display is not updated in the tokens page

web/cashtab/src/components/Send/__tests__/__snapshots__/SendToken.test.js.snap
1 ↗(On Diff #29293)

revert

web/cashtab/src/components/Wallet/__tests__/__snapshots__/Wallet.test.js.snap
1 ↗(On Diff #29293)

dito

web/cashtab/src/utils/validation.js
117 ↗(On Diff #29293)

return isValid

This revision now requires changes to proceed.Jul 23 2021, 06:33

Side note: you may want to add yourself a commit hook or something to automate the @generated mark in the snapshots

Fabien requested changes to this revision.Jul 23 2021, 16:57

You missed the main one:

The display is not updated in the tokens page

This revision now requires changes to proceed.Jul 23 2021, 16:57
This revision is now accepted and ready to land.Jul 23 2021, 18:22