Page MenuHomePhabricator

[Cashtab] Contact List
ClosedPublic

Authored by emack on Mar 28 2022, 02:23.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABCc77a34b4a5d7: [Cashtab] Contact List
Summary

As per T2080, this is a frequently requested feature from the community across numerous channels.

New Contact List feature added to the Configure and Home components. Contacts can be added via a link from the Tx History dropdowns. Each contact can be renamed, route to Send screen, copied to clipboard or deleted.

This option will only appear for new transactions or old transactions with messages, as prior to this diff only inbound transactions with OP_RETURN messages were storing the sender address.

Within Configure.js, the contact list is an array of objects. Each object has a name and address attribute.

In terms of UI, the Contact List dropdown is kept close to the Saved wallets dropdown in order to group and differentiate them from the main New/Import Wallet buttons.

Subsequent diffs will improve upon this feature by allowing cvs export/import of contact lists.

Will chat to you re: the Configure unit tests on tg.

Test Plan
  • Navigate to Home and ensure the Add to Contacts option is only available for new inbound transactions or old transactions with OP_RETURN messages
  • Pick an inbound tx and click Add to contacts and ensure app routes to the Configure screen with the Contact List dropdown already opened, along with a general notification of adding this address to the contact list.
  • Click the pen icon next to this newly added contact and enter a new name that is close to 24 characters. Ensure overflow css shows the entirety of the long name and address when mouseover.
  • Rename the same cotact and ensure the new name is reflected.
  • Click on the contact address and ensure it is copied to clipboard
  • Restart browser and ensure this data persisted via local storage
  • Attempt to add this same contact via the Add to Contacts option and ensure that while the app routes to the Configure page, a general notification is displayed indicating this contact already exists in the contact list.
  • Click on the Send icon for the contact and ensure routing to the Send screen with the address already pre-populated
  • Go back to the contact list and delete the newly added contact and ensure the dropdown displays 'Your contact list is empty'
  • Add more than one contact and observe the dropdown length extending.
  • Ensure no cosmetic conflicts with the Saved Wallets dropdown
  • Test localforage behaviour across Chrome, Firefox and Brave
  • Test localforage behaviour across Extension and iOS/Android
  • Test localforage behaviour with a brand new wallet on a browser wiped clean of old cache

Diff Detail

Repository
rABC Bitcoin ABC
Branch
contactlist2
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18662
Build 37115: Build Diffcashtab-tests
Build 37114: arc lint + arc unit

Event Timeline

emack requested review of this revision.Mar 28 2022, 02:23

Failed tests logs:

====== CashTab Unit Tests:  Configure without a wallet ======
TypeError: Cannot read property 'location' of undefined
    at useLocation (/work/web/cashtab/node_modules/react-router/modules/hooks.js:29:10)
    at Configure (/work/web/cashtab/src/components/Configure/Configure.js:400:22)
    at renderWithHooks (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6016:18)
    at mountIndeterminateComponent (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8744:13)
    at beginWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9966:16)
    at performUnitOfWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13800:12)
    at workLoopSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13728:5)
    at renderRootSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13691:7)
    at performSyncWorkOnRoot (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13404:18)
    at /work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
    at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:646:12)
    at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
    at flushSyncCallbackQueueImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
    at flushSyncCallbackQueue (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
    at scheduleUpdateOnFiber (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13004:9)
    at updateContainer (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16454:3)
    at Object.create (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:18:32)
    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 ======
TypeError: Cannot read property 'location' of undefined
    at useLocation (/work/web/cashtab/node_modules/react-router/modules/hooks.js:29:10)
    at Configure (/work/web/cashtab/src/components/Configure/Configure.js:400:22)
    at renderWithHooks (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6016:18)
    at mountIndeterminateComponent (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8744:13)
    at beginWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9966:16)
    at performUnitOfWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13800:12)
    at workLoopSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13728:5)
    at renderRootSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13691:7)
    at performSyncWorkOnRoot (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13404:18)
    at /work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
    at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:646:12)
    at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
    at flushSyncCallbackQueueImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
    at flushSyncCallbackQueue (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
    at scheduleUpdateOnFiber (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13004:9)
    at updateContainer (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16454:3)
    at Object.create (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:29:32)
    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: Configure without a wallet
CashTab Unit Tests: Configure with a wallet

Updated error notifications in place of general notifications

Failed tests logs:

====== CashTab Unit Tests:  Configure without a wallet ======
TypeError: Cannot read property 'location' of undefined
    at useLocation (/work/web/cashtab/node_modules/react-router/modules/hooks.js:29:10)
    at Configure (/work/web/cashtab/src/components/Configure/Configure.js:403:22)
    at renderWithHooks (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6016:18)
    at mountIndeterminateComponent (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8744:13)
    at beginWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9966:16)
    at performUnitOfWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13800:12)
    at workLoopSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13728:5)
    at renderRootSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13691:7)
    at performSyncWorkOnRoot (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13404:18)
    at /work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
    at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:646:12)
    at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
    at flushSyncCallbackQueueImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
    at flushSyncCallbackQueue (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
    at scheduleUpdateOnFiber (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13004:9)
    at updateContainer (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16454:3)
    at Object.create (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:18:32)
    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 ======
TypeError: Cannot read property 'location' of undefined
    at useLocation (/work/web/cashtab/node_modules/react-router/modules/hooks.js:29:10)
    at Configure (/work/web/cashtab/src/components/Configure/Configure.js:403:22)
    at renderWithHooks (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6016:18)
    at mountIndeterminateComponent (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8744:13)
    at beginWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9966:16)
    at performUnitOfWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13800:12)
    at workLoopSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13728:5)
    at renderRootSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13691:7)
    at performSyncWorkOnRoot (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13404:18)
    at /work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
    at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:646:12)
    at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
    at flushSyncCallbackQueueImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
    at flushSyncCallbackQueue (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
    at scheduleUpdateOnFiber (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13004:9)
    at updateContainer (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16454:3)
    at Object.create (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:29:32)
    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: Configure without a wallet
CashTab Unit Tests: Configure with a wallet

Failed tests logs:

====== CashTab Unit Tests:  Wallet without BCH balance ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet without BCH balance 1`

- Snapshot  - 10
+ Received  + 10

@@ -1,43 +1,43 @@
  Array [
    <div
-     className="sc-ksYbfQ EFpnD"
+     className="sc-cJSrbW jPTFkt"
    >
      <h4
-       className="sc-bbmXgH cXxYjE"
+       className="sc-uJMKN cKiOJP"
      >
        MigrationTestAlpha
      </h4>
      <div
-       className="sc-frDJqD eedyCO"
+       className="sc-hmzhuo jGtnCu"
      >
        0
         
        XEC
      </div>
    </div>,
    <div
-     className="sc-kgAjT fyrqRY"
+     className="sc-TOsTZ ePGIdr"
    >
      <div
-       className="sc-gGBfsJ jUIZZs"
+       className="sc-bbmXgH cDnIaX"
      >
        <button
-         className="sc-jnlKLf izRvRI"
+         className="sc-gGBfsJ nhSkV"
          onClick={[Function]}
        >
          Transactions
        </button>
        <button
-         className="sc-jnlKLf lblEKN"
+         className="sc-gGBfsJ cUGrfZ"
          onClick={[Function]}
        >
          eTokens
        </button>
      </div>
      <div
-       className="sc-fYxtnH fiPSMX"
+       className="sc-jnlKLf bEDump"
      >
        <div />
        <span
          aria-label="party emoji"
          role="img"
@@ -60,14 +60,14 @@
         
        XEC
         to send to others
      </div>
      <div
-       className="sc-fYxtnH hfLMVU"
+       className="sc-jnlKLf iofjAr"
      >
        <a
-         className="sc-cIShpX fxEPvd"
+         className="sc-ktHwxA bInOhz"
          href="/tokens"
          onClick={[Function]}
        >
          Create eToken
        </a>
    at Object.<anonymous> (/work/web/cashtab/src/components/Home/__tests__/Home.test.js:26:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Wallet with BCH balances ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances 1`

- Snapshot  - 10
+ Received  + 10

@@ -1,43 +1,43 @@
  Array [
    <div
-     className="sc-ksYbfQ EFpnD"
+     className="sc-cJSrbW jPTFkt"
    >
      <h4
-       className="sc-bbmXgH cXxYjE"
+       className="sc-uJMKN cKiOJP"
      >
        MigrationTestAlpha
      </h4>
      <div
-       className="sc-frDJqD eedyCO"
+       className="sc-hmzhuo jGtnCu"
      >
        0
         
        XEC
      </div>
    </div>,
    <div
-     className="sc-kgAjT fyrqRY"
+     className="sc-TOsTZ ePGIdr"
    >
      <div
-       className="sc-gGBfsJ jUIZZs"
+       className="sc-bbmXgH cDnIaX"
      >
        <button
-         className="sc-jnlKLf izRvRI"
+         className="sc-gGBfsJ nhSkV"
          onClick={[Function]}
        >
          Transactions
        </button>
        <button
-         className="sc-jnlKLf lblEKN"
+         className="sc-gGBfsJ cUGrfZ"
          onClick={[Function]}
        >
          eTokens
        </button>
      </div>
      <div
-       className="sc-fYxtnH fiPSMX"
+       className="sc-jnlKLf bEDump"
      >
        <div />
        <span
          aria-label="party emoji"
          role="img"
@@ -60,14 +60,14 @@
         
        XEC
         to send to others
      </div>
      <div
-       className="sc-fYxtnH hfLMVU"
+       className="sc-jnlKLf iofjAr"
      >
        <a
-         className="sc-cIShpX fxEPvd"
+         className="sc-ktHwxA bInOhz"
          href="/tokens"
          onClick={[Function]}
        >
          Create eToken
        </a>
    at Object.<anonymous> (/work/web/cashtab/src/components/Home/__tests__/Home.test.js:40:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens ======
Error: expect(received).toMatchSnapshot()

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

- Snapshot  - 10
+ Received  + 10

@@ -1,43 +1,43 @@
  Array [
    <div
-     className="sc-ksYbfQ EFpnD"
+     className="sc-cJSrbW jPTFkt"
    >
      <h4
-       className="sc-bbmXgH cXxYjE"
+       className="sc-uJMKN cKiOJP"
      >
        MigrationTestAlpha
      </h4>
      <div
-       className="sc-frDJqD eedyCO"
+       className="sc-hmzhuo jGtnCu"
      >
        0
         
        XEC
      </div>
    </div>,
    <div
-     className="sc-kgAjT fyrqRY"
+     className="sc-TOsTZ ePGIdr"
    >
      <div
-       className="sc-gGBfsJ jUIZZs"
+       className="sc-bbmXgH cDnIaX"
      >
        <button
-         className="sc-jnlKLf izRvRI"
+         className="sc-gGBfsJ nhSkV"
          onClick={[Function]}
        >
          Transactions
        </button>
        <button
-         className="sc-jnlKLf lblEKN"
+         className="sc-gGBfsJ cUGrfZ"
          onClick={[Function]}
        >
          eTokens
        </button>
      </div>
      <div
-       className="sc-fYxtnH fiPSMX"
+       className="sc-jnlKLf bEDump"
      >
        <div />
        <span
          aria-label="party emoji"
          role="img"
@@ -60,14 +60,14 @@
         
        XEC
         to send to others
      </div>
      <div
-       className="sc-fYxtnH hfLMVU"
+       className="sc-jnlKLf iofjAr"
      >
        <a
-         className="sc-cIShpX fxEPvd"
+         className="sc-ktHwxA bInOhz"
          href="/tokens"
          onClick={[Function]}
        >
          Create eToken
        </a>
    at Object.<anonymous> (/work/web/cashtab/src/components/Home/__tests__/Home.test.js:54:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== 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  - 10
+ Received  + 10

@@ -1,43 +1,43 @@
  Array [
    <div
-     className="sc-ksYbfQ EFpnD"
+     className="sc-cJSrbW jPTFkt"
    >
      <h4
-       className="sc-bbmXgH cXxYjE"
+       className="sc-uJMKN cKiOJP"
      >
        MigrationTestAlpha
      </h4>
      <div
-       className="sc-frDJqD eedyCO"
+       className="sc-hmzhuo jGtnCu"
      >
        0.06
         
        XEC
      </div>
    </div>,
    <div
-     className="sc-kgAjT fyrqRY"
+     className="sc-TOsTZ ePGIdr"
    >
      <div
-       className="sc-gGBfsJ jUIZZs"
+       className="sc-bbmXgH cDnIaX"
      >
        <button
-         className="sc-jnlKLf izRvRI"
+         className="sc-gGBfsJ nhSkV"
          onClick={[Function]}
        >
          Transactions
        </button>
        <button
-         className="sc-jnlKLf lblEKN"
+         className="sc-gGBfsJ cUGrfZ"
          onClick={[Function]}
        >
          eTokens
        </button>
      </div>
      <div
-       className="sc-fYxtnH fiPSMX"
+       className="sc-jnlKLf bEDump"
      >
        <div />
        <span
          aria-label="party emoji"
          role="img"
@@ -60,14 +60,14 @@
         
        XEC
         to send to others
      </div>
      <div
-       className="sc-fYxtnH hfLMVU"
+       className="sc-jnlKLf iofjAr"
      >
        <a
-         className="sc-cIShpX fxEPvd"
+         className="sc-ktHwxA bInOhz"
          href="/tokens"
          onClick={[Function]}
        >
          Create eToken
        </a>
    at Object.<anonymous> (/work/web/cashtab/src/components/Home/__tests__/Home.test.js:70:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Configure without a wallet ======
TypeError: Cannot read property 'location' of undefined
    at useLocation (/work/web/cashtab/node_modules/react-router/modules/hooks.js:29:10)
    at Configure (/work/web/cashtab/src/components/Configure/Configure.js:405:22)
    at renderWithHooks (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6016:18)
    at mountIndeterminateComponent (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8744:13)
    at beginWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9966:16)
    at performUnitOfWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13800:12)
    at workLoopSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13728:5)
    at renderRootSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13691:7)
    at performSyncWorkOnRoot (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13404:18)
    at /work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
    at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:468:12)
    at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
    at flushSyncCallbackQueueImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
    at flushSyncCallbackQueue (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
    at scheduleUpdateOnFiber (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13004:9)
    at updateContainer (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16454:3)
    at Object.create (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:9:32)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Configure with a wallet ======
TypeError: Cannot read property 'location' of undefined
    at useLocation (/work/web/cashtab/node_modules/react-router/modules/hooks.js:29:10)
    at Configure (/work/web/cashtab/src/components/Configure/Configure.js:405:22)
    at renderWithHooks (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6016:18)
    at mountIndeterminateComponent (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8744:13)
    at beginWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9966:16)
    at performUnitOfWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13800:12)
    at workLoopSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13728:5)
    at renderRootSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13691:7)
    at performSyncWorkOnRoot (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13404:18)
    at /work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
    at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:468:12)
    at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
    at flushSyncCallbackQueueImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
    at flushSyncCallbackQueue (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
    at scheduleUpdateOnFiber (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13004:9)
    at updateContainer (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16454:3)
    at Object.create (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:21:32)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)

Each failure log is accessible here:
CashTab Unit Tests: Wallet without BCH balance
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: Configure without a wallet
CashTab Unit Tests: Configure with a wallet

npm test and update snapshots to get unit tests passing in ci

This revision now requires changes to proceed.Mar 30 2022, 18:06

Failed tests logs:

====== CashTab Unit Tests:  Configure without a wallet ======
TypeError: Cannot read property 'location' of undefined
    at useLocation (/work/web/cashtab/node_modules/react-router/modules/hooks.js:29:10)
    at Configure (/work/web/cashtab/src/components/Configure/Configure.js:405:22)
    at renderWithHooks (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6016:18)
    at mountIndeterminateComponent (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8744:13)
    at beginWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9966:16)
    at performUnitOfWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13800:12)
    at workLoopSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13728:5)
    at renderRootSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13691:7)
    at performSyncWorkOnRoot (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13404:18)
    at /work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
    at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:468:12)
    at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
    at flushSyncCallbackQueueImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
    at flushSyncCallbackQueue (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
    at scheduleUpdateOnFiber (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13004:9)
    at updateContainer (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16454:3)
    at Object.create (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:9:32)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Configure with a wallet ======
TypeError: Cannot read property 'location' of undefined
    at useLocation (/work/web/cashtab/node_modules/react-router/modules/hooks.js:29:10)
    at Configure (/work/web/cashtab/src/components/Configure/Configure.js:405:22)
    at renderWithHooks (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6016:18)
    at mountIndeterminateComponent (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8744:13)
    at beginWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9966:16)
    at performUnitOfWork (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13800:12)
    at workLoopSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13728:5)
    at renderRootSync (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13691:7)
    at performSyncWorkOnRoot (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13404:18)
    at /work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
    at unstable_runWithPriority (/work/web/cashtab/node_modules/scheduler/cjs/scheduler.development.js:468:12)
    at runWithPriority (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
    at flushSyncCallbackQueueImpl (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
    at flushSyncCallbackQueue (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
    at scheduleUpdateOnFiber (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13004:9)
    at updateContainer (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16454:3)
    at Object.create (/work/web/cashtab/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:21:32)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)

Each failure log is accessible here:
CashTab Unit Tests: Configure without a wallet
CashTab Unit Tests: Configure with a wallet

bytesofman added inline comments.
web/cashtab/src/components/Common/Ticker.js
16 ↗(On Diff #33023)

These are hardcoded for other parts of the wallet model -- follow this standard. Not sure what value is added from keeping this as a param. We want the wallet model to be as static as possible.

web/cashtab/src/components/Configure/Configure.js
4 ↗(On Diff #33023)

Follow model of other localforage calls on this page -- keep all localforage functions in useWallet.js

405 ↗(On Diff #33023)

This is causing unit tests to fail, may need to mock

To see failing unit tests:

npm test
f

Checkout the beforeEach block in Send.test.js, which also uses useLocation -- including it iun Configure.test.js may fix the test.

This revision now requires changes to proceed.Mar 31 2022, 22:07
emack marked 2 inline comments as done.

Moved the localforage calls into useWallet, still troubleshooting the unit test failures though

Tail of the build log:

  Configure.js                   |       0 |        0 |       0 |       0 | 45-1307                                                                                                                                                                                                                                                                                                                                                            
 src/components/Home             |   55.38 |    23.15 |   26.02 |   55.38 |                                                                                                                                                                                                                                                                                                                                                                    
  Home.js                        |   67.44 |    78.57 |   46.15 |   67.44 | 69-85,95-112,171-178                                                                                                                                                                                                                                                                                                                                               
  TokenList.js                   |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                                                                                                                                                    
  TokenListItem.js               |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                                                                                                                                                    
  Tx.js                          |   38.57 |        0 |       0 |   38.57 | 48,52-54,57-59,63,80-93,105-118,127-158,167,173,178,191-204,219,260,276,282-291,303,308-650                                                                                                                                                                                                                                                                        
  TxHistory.js                   |      75 |      100 |      50 |      75 | 9                                                                                                                                                                                                                                                                                                                                                                  
 src/components/OnBoarding       |      50 |     8.33 |   35.71 |   51.61 |                                                                                                                                                                                                                                                                                                                                                                    
  OnBoarding.js                  |      50 |     8.33 |   35.71 |   51.61 | 57-68,72-92,122-157                                                                                                                                                                                                                                                                                                                                                
 src/components/Receive          |   86.36 |       60 |   72.72 |   86.36 |                                                                                                                                                                                                                                                                                                                                                                    
  Receive.js                     |   86.36 |       60 |   72.72 |   86.36 | 61,99-105                                                                                                                                                                                                                                                                                                                                                          
 src/components/Send             |   26.82 |    29.23 |    9.47 |   27.37 |                                                                                                                                                                                                                                                                                                                                                                    
  Send.js                        |   27.24 |    32.84 |    8.77 |   28.17 | 70,74,79,84,166-170,174-180,185-186,190,212,220,228-234,250-407,413-468,475-497,501-559,566-568,575-585,592-598,603-612,616-627,632-654,658-676,680-681,687-708,742,824-1270                                                                                                                                                                                       
  SendToken.js                   |   26.06 |    23.14 |   10.52 |   25.92 | 55-59,70-87,134-137,143-200,205-229,236-273,281-292,299-303,308-309,313,317-326,330-383,388-395,399-400,437-675                                                                                                                                                                                                                                                    
 src/components/Tokens           |   28.97 |    35.84 |      16 |   29.24 |                                                                                                                                                                                                                                                                                                                                                                    
  CreateTokenForm.js             |   24.87 |    33.33 |   12.76 |   25.12 | 93,97-126,131,135-219,224-228,233-251,256-262,272-275,282-285,293-303,311-316,325-328,350-401,409-470,478-703,739-786,809                                                                                                                                                                                                                                          
  TokenIcon.js                   |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                                                                                                                                                    
  Tokens.js                      |      90 |       60 |      50 |      90 | 92                                                                                                                                                                                                                                                                                                                                                                 
 src/hooks                       |   38.46 |    36.45 |   30.32 |   38.44 |                                                                                                                                                                                                                                                                                                                                                                    
  useAsyncTimeout.js             |   77.77 |       50 |   83.33 |   82.35 | 20,25-26                                                                                                                                                                                                                                                                                                                                                           
  useBCH.js                      |   54.57 |    53.62 |   40.38 |   54.13 | 115-116,161,179-182,202-203,213-258,266,273-274,340-356,362-378,383-415,477-503,513-532,541-550,555-588,593-599,606-612,619-625,632-638,646-686,709-717,816,862,894-896,944,951,953,955,960,973-979,990-1152,1163,1177,1192-1308,1312-1320,1329-1330,1347-1348,1353,1371-1372,1399,1423,1456,1462-1465,1486-1487,1501,1549,1552,1621,1628,1630,1632,1637,1647-1650 
  useImage.js                    |       0 |        0 |       0 |       0 | 1-199                                                                                                                                                                                                                                                                                                                                                              
  useInnerScroll.js              |       0 |      100 |       0 |       0 | 3-6                                                                                                                                                                                                                                                                                                                                                                
  useInterval.js                 |       0 |      100 |       0 |       0 | 3-16                                                                                                                                                                                                                                                                                                                                                               
  usePrevious.js                 |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                                                                                                                                                    
  useWallet.js                   |   29.08 |    20.52 |    37.2 |   29.58 | 68-71,79-80,91-99,103-107,135-139,151-194,219-363,382-383,389-396,400-407,424-427,443-449,504-507,515-520,529-559,570-590,600-719,725-759,768-805,810-859,863-889,898-908,930-934,942-943,953-958,963,969-1014,1029,1052-1123,1160-1178,1205-1224                                                                                                                  
  useWebAuthentication.js        |    1.47 |        0 |       0 |    1.51 | 12-235                                                                                                                                                                                                                                                                                                                                                             
  useWindowDimensions.js         |   77.77 |      100 |      60 |    87.5 | 21                                                                                                                                                                                                                                                                                                                                                                 
 src/utils                       |   85.15 |    86.31 |   72.46 |   84.76 |                                                                                                                                                                                                                                                                                                                                                                    
  GoogleAnalytics.js             |   27.27 |        0 |   14.28 |   28.57 | 9-39,54-59                                                                                                                                                                                                                                                                                                                                                         
  cashMethods.js                 |   90.49 |     87.5 |   92.85 |   89.76 | 16,63,199,264,284,293,315,355,369,442-494,503-508                                                                                                                                                                                                                                                                                                                  
  context.js                     |      60 |      100 |       0 |      60 | 9-10,22-23                                                                                                                                                                                                                                                                                                                                                         
  convertArrBuffBase64.js        |      20 |      100 |       0 |   22.22 | 3-10,15-18                                                                                                                                                                                                                                                                                                                                                         
  debounce.js                    |       0 |        0 |       0 |       0 | 4-8                                                                                                                                                                                                                                                                                                                                                                
  formatting.js                  |   78.12 |    76.92 |     100 |   78.12 | 15,25,43,53,68-70                                                                                                                                                                                                                                                                                                                                                  
  retry.js                       |       0 |        0 |       0 |       0 | 1-8                                                                                                                                                                                                                                                                                                                                                                
  tokenMethods.js                |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                                                                                                                                                    
  validation.js                  |   97.56 |    96.26 |     100 |   97.52 | 139,297-300                                                                                                                                                                                                                                                                                                                                                        
 src/utils/icons                 |    2.52 |        0 |       0 |    2.72 |                                                                                                                                                                                                                                                                                                                                                                    
  cropImage.js                   |    2.27 |        0 |       0 |    2.43 | 2-78                                                                                                                                                                                                                                                                                                                                                               
  resizeImage.js                 |    2.77 |        0 |       0 |    3.03 | 2-51                                                                                                                                                                                                                                                                                                                                                               
  roundImage.js                  |    2.56 |        0 |       0 |    2.77 | 2-57                                                                                                                                                                                                                                                                                                                                                               
---------------------------------|---------|----------|---------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='1524']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='3755']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='630']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='1635']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='241']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='830']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='1479']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='3642']
##teamcity[blockClosed name='Code Coverage Summary']
Test Suites: 1 failed, 17 passed, 18 total
Tests:       334 passed, 334 total
Snapshots:   31 passed, 31 total
Time:        17.692 s
Ran all test suites.
Build cashtab-tests failed with exit code 1
bytesofman requested changes to this revision.Apr 5 2022, 22:11

Whew not a fun time in jest on this one. I managed to get the unit test to work, and it did turn up some errors we can correct.

  1. Wrap the <Configure> element in a <Router> element to use useLocation; see Send.test.js as a model
  2. Include the beforeEach block used in Send.test.js
  3. The list mapped with <ContactListArrayRow>: Remove the wrapping empty element <></>, and add a unique key , e.g.
{contactListArray &&
                                        contactListArray.length > 0
                                            ? contactListArray.map(
                                                  (element, index) => (
                                                      <ContactListRow
                                                          key={`${index}_${element.address}`}
  1. Match the syntax of the other imported localforage functions; the jest TypeError thrown by getContactListFromLocalForage is because the function is called outside of a try..catch block. All async functions need to be called in a try...catch block.
This revision now requires changes to proceed.Apr 5 2022, 22:11
  • All unit tests now passing.
  • Adjusted wrap styling for inbound tx dropdowns where all four actions (copy Tx Id, Copy Msg, View on be.cash and Add to contacts) are all present on the same row.
  • Tested across browsers, extension plugin and iOS/Android browsers.
  • Let me know if this is a significant enough feature to bring out Cassandra for.
bytesofman requested changes to this revision.Apr 8 2022, 14:26

Good diff and useful feature. In general, it's important to have the delete and rename options. However, we need to make a concerted effort to reduce the size of Cashtab diffs. This should either be a stacked diff or a series of related diffs.

1 - MVP, working contact lits
2 - Ability to delete
3 - Ability to rename

Please refactor so this is an MVP diff. Your work already completed will make inserting the separate diffs easier.

web/cashtab/src/components/Configure/Configure.js
560 ↗(On Diff #33110)

newContactObj is defined in both the if and else blocks. Instead, define it one time before these blocks.

1274 ↗(On Diff #33110)

We do not need the key param here

web/cashtab/src/hooks/useBCH.js
301 ↗(On Diff #33110)

Add some comments to explain what's going on now; seems like the comments in the codebase above are no longer relevant here?

This revision now requires changes to proceed.Apr 8 2022, 14:26
emack marked 3 inline comments as done.

Refactored to MVP contact list function, including recent feedback.
Re: the feedback on removing the 'key' param in Configure.js, this is needed for the defaultActiveKey attribute directly above to open the dropdown by default when the user is routed from the Tx History.

The following 4 diffs will be landed in quick succession.

bytesofman added inline comments.
web/cashtab/src/components/Configure/Configure.js
510 ↗(On Diff #33130)

Default names should be unique. Options: Use the first 5 characters of the address, or use Contact 1, Contact 2, Contact 3, ..., Contact n, depending on the size of the list.

585 ↗(On Diff #33130)

This is useful for testing, but should be removed from the diff.

1006 ↗(On Diff #33130)

Remove key param (Panel has no siblings)

1016 ↗(On Diff #33130)

I know i suggested this arrangement...but I think we only need index

1060 ↗(On Diff #33130)

Include instructions for how to add a contact, e.g. Add a contact by clicking on a received transaction and looking for the 'add contact' icon

This revision now requires changes to proceed.Apr 10 2022, 09:36
emack marked 5 inline comments as done.Apr 10 2022, 11:17
emack added inline comments.
web/cashtab/src/components/Configure/Configure.js
1006 ↗(On Diff #33130)

the key param is needed here so the defaultActiveKey above it can open this contact list dropdown by default if the user was routed from the Tx History screen (i.e. they clicked 'Add to contacts' to get here)

emack marked an inline comment as done.

Default names now taking the first 5 characters of the address. Adjusted index variable usage in array map rendering and added additional instruction to empty contact lists.

bytesofman added inline comments.
web/cashtab/src/components/Configure/Configure.js
1013 ↗(On Diff #33133)

Keep element and index in the .map; it's just that the key can be purely index instead of this string.

This revision now requires changes to proceed.Apr 10 2022, 11:24
emack marked an inline comment as done.

Reinstated element in array map and adjusted key param to purely index

This revision is now accepted and ready to land.Apr 11 2022, 12:38
This revision was automatically updated to reflect the committed changes.