Page MenuHomePhabricator

[Cashtab] Standardize getters and setters for cashtabSettings
AbandonedPublicDraft

Authored by bytesofman on Feb 20 2024, 00:10.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

Manage settings in state and localforage using new Cashtab standard

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
settings-to-better-storage
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27269
Build 54101: Build Diffcashtab-tests
Build 54100: arc lint + arc unit

Event Timeline

Tail of the build log:

/work/cashtab /work/abc-ci-builds/cashtab-tests
npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm WARN deprecated @babel/plugin-proposal-private-methods@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.
npm WARN deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm WARN deprecated @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
npm WARN deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated @babel/plugin-proposal-private-property-in-object@7.21.11: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-property-in-object instead.
npm WARN deprecated domexception@4.0.0: Use your platform's native DOMException instead
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
npm WARN deprecated workbox-cacheable-response@6.6.0: workbox-background-sync@6.6.0

added 1912 packages, and audited 1913 packages in 24s

263 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> cashtab@1.1.26 build
> node scripts/build.js

Creating an optimized production build...
Failed to compile.

[eslint] 
src/components/SignVerifyMsg/SignVerifyMsg.js
  Line 3:8:  'PropTypes' is defined but never used  no-unused-vars

Search for the keywords to learn more about each error.


Build cashtab-tests failed with exit code 1

Failed tests logs:

====== CashTab Unit Tests: useWallet hook rendering in different localforage states Cashtab loads wallet, settings, cache, and contactlist from localforage to context if they are present ======
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 6
+ Received  + 1

- Array [
-   Object {
-     "address": "ecash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6",
-     "name": "test",
-   },
- ]
+ Array []

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>
    at toStrictEqual (/work/cashtab/src/hooks/__tests__/useWalletStorage.test.js:40:61)
    at runWithExpensiveErrorDiagnosticsDisabled (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:47:12)
    at checkCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:124:77)
    at checkRealTimersCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:118:16)
    at Timeout.task [as _onTimeout] (/work/cashtab/node_modules/jsdom/lib/jsdom/browser/Window.js:520:19)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)
====== CashTab Unit Tests: useWallet hook rendering in different localforage states Cashtab loads wallet, settings, cache, and contactlist as expected defaults if localforage is empty ======
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 0
+ Received  + 7

  Object {
    "contactList": Array [],
+   "settings": Object {
+     "autoCameraOn": true,
+     "balanceVisible": true,
+     "fiatCurrency": "usd",
+     "hideMessagesFromUnknownSenders": false,
+     "sendModal": false,
+   },
  }

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>
    at toStrictEqual (/work/cashtab/src/hooks/__tests__/useWalletStorage.test.js:75:49)
    at runWithExpensiveErrorDiagnosticsDisabled (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:47:12)
    at checkCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:124:77)
    at checkRealTimersCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:118:16)
    at Timeout.task [as _onTimeout] (/work/cashtab/node_modules/jsdom/lib/jsdom/browser/Window.js:520:19)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)
====== CashTab Unit Tests: <App /> Navigation menu routes to expected components ======
Error: Unable to find an element by: [data-testid="home-ctn"]

Ignored nodes: comments, script, style
<body>
  <div />
</body>
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:86:33
    at Object.findByTestId (/work/cashtab/src/components/__tests__/App.test.js:84:22)
====== CashTab Unit Tests: <App /> Renders the App screen showing normal wallet info for a created wallet ======
TypeError: Cannot read properties of undefined (reading 'hideMessagesFromUnknownSenders')
    at hideMessagesFromUnknownSenders (/work/cashtab/src/components/Home/Tx.js:842:73)
    at renderWithHooks (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:16305:18)
    at mountIndeterminateComponent (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:20074:13)
    at beginWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:21587:16)
    at beginWork$1 (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:27426:14)
    at performUnitOfWork (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26560:12)
    at workLoopSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26466:5)
    at renderRootSync (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:26434:7)
    at recoverFromConcurrentError (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25850:20)
    at performConcurrentWorkOnRoot (/work/cashtab/node_modules/react-dom/cjs/react-dom.development.js:25750:22)
    at workLoop (/work/cashtab/node_modules/scheduler/cjs/scheduler.development.js:266:34)
    at flushWork (/work/cashtab/node_modules/scheduler/cjs/scheduler.development.js:239:14)
    at performWorkUntilDeadline (/work/cashtab/node_modules/scheduler/cjs/scheduler.development.js:533:21)
    at Timeout.task [as _onTimeout] (/work/cashtab/node_modules/jsdom/lib/jsdom/browser/Window.js:520:19)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)
====== CashTab Unit Tests: <CashtabTestWrapper /> With default props, renders App component ======
Error: Unable to find an element by: [data-testid="home-ctn"]

Ignored nodes: comments, script, style
<body>
  <div />
</body>
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:86:33
    at Object.findByTestId (/work/cashtab/src/components/fixtures/__tests__/CashtabTestWrapper.test.js:78:29)
    at runNextTicks (node:internal/process/task_queues:60:5)
    at listOnTimeout (node:internal/timers:540:9)
    at processTimers (node:internal/timers:514:7)
====== CashTab Unit Tests: <Configure /> We can add, delete, rename, contacts from the Configure screen, and add a savedWallet as a contact ======
TestingLibraryElementError: Unable to find an element with the text: OK. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div />
</body>
    at Object.getElementError (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:37:19)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:76:38
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:52:17
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:95:19
    at Object.getByText (/work/cashtab/src/components/Configure/__tests__/Configure.test.js:134:38)
====== CashTab Unit Tests: <App /> Renders API error if called with wallet in localforage but chronik utxo calls fail ======
Error: Unable to find an element by: [data-testid="api-error"]

Ignored nodes: comments, script, style
<body>
  <div />
</body>
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:86:33
    at Object.findByTestId (/work/cashtab/src/components/__tests__/AppIntegrations.test.js:85:22)
====== CashTab Unit Tests: <App /> Adding a contact to Configure.js from clicking on tx history adds it to localforage and wallet context ======
TypeError: Cannot read properties of null (reading 'querySelector')

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>...
    at /work/cashtab/src/components/__tests__/AppIntegrations.test.js:116:46
    at runWithExpensiveErrorDiagnosticsDisabled (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:47:12)
    at checkCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:124:77)
    at checkRealTimersCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:118:16)
    at Timeout.task [as _onTimeout] (/work/cashtab/node_modules/jsdom/lib/jsdom/browser/Window.js:520:19)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)
====== CashTab Unit Tests: <App /> Adding a contact to an existing contactList by clicking on tx history adds it to localforage and wallet context ======
TypeError: Cannot read properties of null (reading 'querySelector')

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>...
    at /work/cashtab/src/components/__tests__/AppIntegrations.test.js:168:46
    at runWithExpensiveErrorDiagnosticsDisabled (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:47:12)
    at checkCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:124:77)
    at checkRealTimersCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:118:16)
    at Timeout.task [as _onTimeout] (/work/cashtab/node_modules/jsdom/lib/jsdom/browser/Window.js:520:19)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)
====== CashTab Unit Tests: <App /> A user with legacy blank contactList in localstorage is migrated on startup ======
Error: Unable to find an element by: [data-testid="wallet-info-ctn"]

Ignored nodes: comments, script, style
<body>
  <div />
</body>
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:86:33
    at Object.findByTestId (/work/cashtab/src/components/__tests__/AppIntegrations.test.js:215:26)
====== CashTab Unit Tests: <App /> Clicking "reply" on a Cashtab Msg correctly populates the SendXec to address and amount fields ======
Error: Unable to find an element by: [data-testid="cashtab-msg-reply"]

Ignored nodes: comments, script, style
<body>
  <div />
</body>
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at Object.<anonymous> (/work/cashtab/src/components/__tests__/AppIntegrations.test.js:259:22)

Each failure log is accessible here:
CashTab Unit Tests: useWallet hook rendering in different localforage states Cashtab loads wallet, settings, cache, and contactlist from localforage to context if they are present
CashTab Unit Tests: useWallet hook rendering in different localforage states Cashtab loads wallet, settings, cache, and contactlist as expected defaults if localforage is empty
CashTab Unit Tests: <App /> Navigation menu routes to expected components
CashTab Unit Tests: <App /> Renders the App screen showing normal wallet info for a created wallet
CashTab Unit Tests: <CashtabTestWrapper /> With default props, renders App component
CashTab Unit Tests: <Configure /> We can add, delete, rename, contacts from the Configure screen, and add a savedWallet as a contact
CashTab Unit Tests: <App /> Renders API error if called with wallet in localforage but chronik utxo calls fail
CashTab Unit Tests: <App /> Adding a contact to Configure.js from clicking on tx history adds it to localforage and wallet context
CashTab Unit Tests: <App /> Adding a contact to an existing contactList by clicking on tx history adds it to localforage and wallet context
CashTab Unit Tests: <App /> A user with legacy blank contactList in localstorage is migrated on startup
CashTab Unit Tests: <App /> Clicking "reply" on a Cashtab Msg correctly populates the SendXec to address and amount fields