Page MenuHomePhabricator

[Cashtab] Show XECX balance
Needs RevisionPublic

Authored by bytesofman on Fri, Jan 10, 00:57.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Summary

Show XECX balance in balance header, if it is non-zero, with link to token page on ticker

Include XECX balance in total fiat balance

Test Plan

npm test, screenshot

image.png (157×482 px, 25 KB)

Diff Detail

Repository
rABC Bitcoin ABC
Branch
xecx-in-balanceheader
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32026
Build 63544: Build Diffcashtab-tests
Build 63543: arc lint + arc unit

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: <BalanceHeader /> Renders the loader if balanceSats is not an integer ======
Error: Input param satoshis must be an integer
    at toXec (/work/cashtab/src/wallet/index.ts:172:15)
    at BalanceHeader (/work/cashtab/src/components/Common/BalanceHeader.tsx:73:29)
    at renderWithHooks (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:15486:18)
    at mountIndeterminateComponent (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:20103:13)
    at beginWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:21626:16)
    at beginWork$1 (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:27465:14)
    at performUnitOfWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26599:12)
    at workLoopSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26505:5)
    at renderRootSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26473:7)
    at recoverFromConcurrentError (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25889:20)
    at performConcurrentWorkOnRoot (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25789:22)
    at flushActQueue (/work/cashtab/node_modules/react/cjs/react.development.js:2667:24)
    at act (/work/cashtab/node_modules/react/cjs/react.development.js:2582:11)
    at /work/cashtab/node_modules/@testing-library/react/dist/act-compat.js:47:25
    at renderRoot (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:180:26)
    at render (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:271:10)
    at Object.<anonymous> (/work/cashtab/src/components/Common/__tests__/BalanceHeader.test.js:13:15)
    at Promise.then.completed (/work/cashtab/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/cashtab/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (/work/cashtab/node_modules/jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at _runTest (/work/cashtab/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:121:9)
    at run (/work/cashtab/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (/work/cashtab/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (/work/cashtab/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (/work/cashtab/node_modules/jest-runner/build/testWorker.js:106:12)
====== CashTab Unit Tests: <BalanceHeader /> Renders the BalanceHeader component correctly with default locale en-US ======
TypeError: Cannot read properties of undefined (reading 'toLocaleString')
    at toLocaleString (/work/cashtab/src/components/Common/BalanceHeader.tsx:80:46)
    at renderWithHooks (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:15486:18)
    at mountIndeterminateComponent (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:20103:13)
    at beginWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:21626:16)
    at beginWork$1 (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:27465:14)
    at performUnitOfWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26599:12)
    at workLoopSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26505:5)
    at renderRootSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26473:7)
    at recoverFromConcurrentError (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25889:20)
    at performConcurrentWorkOnRoot (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25789:22)
    at flushActQueue (/work/cashtab/node_modules/react/cjs/react.development.js:2667:24)
    at act (/work/cashtab/node_modules/react/cjs/react.development.js:2582:11)
    at /work/cashtab/node_modules/@testing-library/react/dist/act-compat.js:47:25
    at renderRoot (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:180:26)
    at render (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:271:10)
    at Object.<anonymous> (/work/cashtab/src/components/Common/__tests__/BalanceHeader.test.js:28:15)
    at Promise.then.completed (/work/cashtab/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/cashtab/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (/work/cashtab/node_modules/jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at _runTest (/work/cashtab/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:121:9)
    at run (/work/cashtab/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (/work/cashtab/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (/work/cashtab/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (/work/cashtab/node_modules/jest-runner/build/testWorker.js:106:12)
====== CashTab Unit Tests: <BalanceHeader /> Renders the BalanceHeader component correctly with fr-FR locale ======
TypeError: Cannot read properties of undefined (reading 'toLocaleString')
    at toLocaleString (/work/cashtab/src/components/Common/BalanceHeader.tsx:80:46)
    at renderWithHooks (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:15486:18)
    at mountIndeterminateComponent (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:20103:13)
    at beginWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:21626:16)
    at beginWork$1 (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:27465:14)
    at performUnitOfWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26599:12)
    at workLoopSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26505:5)
    at renderRootSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26473:7)
    at recoverFromConcurrentError (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25889:20)
    at performConcurrentWorkOnRoot (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25789:22)
    at flushActQueue (/work/cashtab/node_modules/react/cjs/react.development.js:2667:24)
    at act (/work/cashtab/node_modules/react/cjs/react.development.js:2582:11)
    at /work/cashtab/node_modules/@testing-library/react/dist/act-compat.js:47:25
    at renderRoot (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:180:26)
    at render (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:271:10)
    at Object.<anonymous> (/work/cashtab/src/components/Common/__tests__/BalanceHeader.test.js:61:15)
    at Promise.then.completed (/work/cashtab/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/cashtab/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (/work/cashtab/node_modules/jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at _runTest (/work/cashtab/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:121:9)
    at run (/work/cashtab/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (/work/cashtab/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (/work/cashtab/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (/work/cashtab/node_modules/jest-runner/build/testWorker.js:106:12)
====== CashTab Unit Tests: <BalanceHeader /> Balance is hidden if cashtabSettings.balanceVisible is false ======
TypeError: Cannot read properties of undefined (reading 'toLocaleString')
    at toLocaleString (/work/cashtab/src/components/Common/BalanceHeader.tsx:80:46)
    at renderWithHooks (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:15486:18)
    at mountIndeterminateComponent (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:20103:13)
    at beginWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:21626:16)
    at beginWork$1 (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:27465:14)
    at performUnitOfWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26599:12)
    at workLoopSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26505:5)
    at renderRootSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26473:7)
    at recoverFromConcurrentError (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25889:20)
    at performConcurrentWorkOnRoot (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25789:22)
    at flushActQueue (/work/cashtab/node_modules/react/cjs/react.development.js:2667:24)
    at act (/work/cashtab/node_modules/react/cjs/react.development.js:2582:11)
    at /work/cashtab/node_modules/@testing-library/react/dist/act-compat.js:47:25
    at renderRoot (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:180:26)
    at render (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:271:10)
    at Object.<anonymous> (/work/cashtab/src/components/Common/__tests__/BalanceHeader.test.js:95:15)
    at Promise.then.completed (/work/cashtab/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/cashtab/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (/work/cashtab/node_modules/jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at _runTest (/work/cashtab/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:121:9)
    at run (/work/cashtab/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (/work/cashtab/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (/work/cashtab/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (/work/cashtab/node_modules/jest-runner/build/testWorker.js:106:12)
====== CashTab Unit Tests: <BalanceHeader /> Renders fiat price for a non-USD currency ======
TypeError: Cannot read properties of undefined (reading 'toLocaleString')
    at toLocaleString (/work/cashtab/src/components/Common/BalanceHeader.tsx:80:46)
    at renderWithHooks (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:15486:18)
    at mountIndeterminateComponent (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:20103:13)
    at beginWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:21626:16)
    at beginWork$1 (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:27465:14)
    at performUnitOfWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26599:12)
    at workLoopSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26505:5)
    at renderRootSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26473:7)
    at recoverFromConcurrentError (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25889:20)
    at performConcurrentWorkOnRoot (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25789:22)
    at flushActQueue (/work/cashtab/node_modules/react/cjs/react.development.js:2667:24)
    at act (/work/cashtab/node_modules/react/cjs/react.development.js:2582:11)
    at /work/cashtab/node_modules/@testing-library/react/dist/act-compat.js:47:25
    at renderRoot (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:180:26)
    at render (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:271:10)
    at Object.<anonymous> (/work/cashtab/src/components/Common/__tests__/BalanceHeader.test.js:128:15)
    at Promise.then.completed (/work/cashtab/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/cashtab/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (/work/cashtab/node_modules/jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at _runTest (/work/cashtab/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:121:9)
    at run (/work/cashtab/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (/work/cashtab/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (/work/cashtab/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (/work/cashtab/node_modules/jest-runner/build/testWorker.js:106:12)
====== CashTab Unit Tests: <BalanceHeader /> Fiat price and forex are not displayed if fiatPrice is unavailable ======
TypeError: Cannot read properties of undefined (reading 'toLocaleString')
    at toLocaleString (/work/cashtab/src/components/Common/BalanceHeader.tsx:80:46)
    at renderWithHooks (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:15486:18)
    at mountIndeterminateComponent (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:20103:13)
    at beginWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:21626:16)
    at beginWork$1 (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:27465:14)
    at performUnitOfWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26599:12)
    at workLoopSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26505:5)
    at renderRootSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26473:7)
    at recoverFromConcurrentError (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25889:20)
    at performConcurrentWorkOnRoot (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25789:22)
    at flushActQueue (/work/cashtab/node_modules/react/cjs/react.development.js:2667:24)
    at act (/work/cashtab/node_modules/react/cjs/react.development.js:2582:11)
    at /work/cashtab/node_modules/@testing-library/react/dist/act-compat.js:47:25
    at renderRoot (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:180:26)
    at render (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:271:10)
    at Object.<anonymous> (/work/cashtab/src/components/Common/__tests__/BalanceHeader.test.js:159:15)
    at Promise.then.completed (/work/cashtab/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/cashtab/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (/work/cashtab/node_modules/jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at _runTest (/work/cashtab/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:121:9)
    at run (/work/cashtab/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (/work/cashtab/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (/work/cashtab/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (/work/cashtab/node_modules/jest-runner/build/testWorker.js:106:12)
====== CashTab Unit Tests: <Token /> Renders the burn token success notification upon successful burn tx broadcast ======
Error: expect(received).toHaveProperty(path, value)

Expected path: "checked"

Expected value: true
Received value: false
    at Object.toHaveProperty (/work/cashtab/src/components/Etokens/__tests__/Token.test.js:438:56)
====== CashTab Unit Tests: <Agora /> We can see multiple offers, some we made, others we did not, and we can cancel an offer ======
Error: expect(received).toBeInTheDocument()

received value must be an HTMLElement or an SVGElement.
Received has value: undefined
    at __EXTERNAL_MATCHER_TRAP__ (/work/cashtab/node_modules/expect/build/index.js:325:30)
    at Object.throwingMatcher [as toBeInTheDocument] (/work/cashtab/node_modules/expect/build/index.js:326:15)
    at Object.toBeInTheDocument (/work/cashtab/src/components/Agora/__tests__/index.test.js:647:11)

Each failure log is accessible here:
CashTab Unit Tests: <BalanceHeader /> Renders the loader if balanceSats is not an integer
CashTab Unit Tests: <BalanceHeader /> Renders the BalanceHeader component correctly with default locale en-US
CashTab Unit Tests: <BalanceHeader /> Renders the BalanceHeader component correctly with fr-FR locale
CashTab Unit Tests: <BalanceHeader /> Balance is hidden if cashtabSettings.balanceVisible is false
CashTab Unit Tests: <BalanceHeader /> Renders fiat price for a non-USD currency
CashTab Unit Tests: <BalanceHeader /> Fiat price and forex are not displayed if fiatPrice is unavailable
CashTab Unit Tests: <Token /> Renders the burn token success notification upon successful burn tx broadcast
CashTab Unit Tests: <Agora /> We can see multiple offers, some we made, others we did not, and we can cancel an offer

use mocks now that they are available

bytesofman edited the test plan for this revision. (Show Details)
emack requested changes to this revision.Fri, Jan 10, 08:31
emack added a subscriber: emack.
emack added inline comments.
cashtab/src/components/App/App.tsx
106

isn't this conditional || 0 the same as the : 0 below?

This revision now requires changes to proceed.Fri, Jan 10, 08:31