Page MenuHomePhabricator

[Cashtab] Clean up mock files and standardize mock imports for component integration tests
ClosedPublic

Authored by bytesofman on Feb 29 2024, 13:19.

Details

Summary

T3444

We are re-using many mocks and have some legacy mocks that are not used at all.

In cases where different components are using the same mock stored in different files, point to the same mock and delete the repeated mock. Delete unused mocks. Remove @generated from mocks files as, while some are copy-pasted from chronik output, in general they are not @generated and should be reviewed.

Test Plan

npm test

Diff Detail

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

Event Timeline

Tail of the build log:

      at updateFunctionComponent (node_modules/react-dom/cjs/react-dom.development.js:19588:20)
      at beginWork (node_modules/react-dom/cjs/react-dom.development.js:21601:16)
      at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:27426:14)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:26560:12)
      at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:26466:5)
      at renderRootSync (node_modules/react-dom/cjs/react-dom.development.js:26434:7)
      at performConcurrentWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:25738:74)
      at workLoop (node_modules/scheduler/cjs/scheduler.development.js:266:34)
      at flushWork (node_modules/scheduler/cjs/scheduler.development.js:239:14)
      at performWorkUntilDeadline (node_modules/scheduler/cjs/scheduler.development.js:533:21)
      at Timeout.task [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:520:19)

    console.error
      Warning: [rc-collapse] `children` will be removed in next major version. Please use `items` instead.

      at warning (node_modules/rc-util/lib/warning.js:32:15)
      at call (node_modules/rc-util/lib/warning.js:52:5)
      at warningOnce (node_modules/rc-util/lib/warning.js:57:3)
      at node_modules/rc-collapse/lib/Collapse.js:72:24
      at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:16305:18)
      at updateForwardRef (node_modules/react-dom/cjs/react-dom.development.js:19226:20)
      at beginWork (node_modules/react-dom/cjs/react-dom.development.js:21636:16)
      at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:27426:14)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:26560:12)
      at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:26466:5)
      at renderRootSync (node_modules/react-dom/cjs/react-dom.development.js:26434:7)
      at performConcurrentWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:25738:74)
      at workLoop (node_modules/scheduler/cjs/scheduler.development.js:266:34)
      at flushWork (node_modules/scheduler/cjs/scheduler.development.js:239:14)
      at performWorkUntilDeadline (node_modules/scheduler/cjs/scheduler.development.js:533:21)
      at Timeout.task [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:520:19)


Summary of all failing tests
FAIL src/components/Alias/__tests__/Alias.test.js
  ● Test suite failed to run

    ReferenceError: walletWithXecAndTokens is not defined

      3 |         {
      4 |             alias: 'chicken555',
    > 5 |             address: `${walletWithXecAndTokens.Path1899.cashAddress}`,
        |                         ^
      6 |             txid: 'ec92610fc41df2387e7febbb358b138a802ac26023f30b2442aa01ca733fff7d',
      7 |             blockheight: 792417,
      8 |         },

      at Object.walletWithXecAndTokens (src/components/Alias/fixtures/mocks.js:5:25)
      at Object.require (src/components/Alias/__tests__/Alias.test.js:3:1)


Test Suites: 1 failed, 29 passed, 30 total
Tests:       577 passed, 577 total
Snapshots:   0 total
Time:        70.561 s
Ran all test suites.
Jest did not exit one second after the test run has completed.

'This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
Build cashtab-tests failed with exit code 1
This revision is now accepted and ready to land.Feb 29 2024, 14:47