Page MenuHomePhabricator

[Cashtab] [experimental p3] Install local dependency xecjs-lib for local testing
AbandonedPublic

Authored by bytesofman on Nov 25 2022, 14:29.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

T2730

Install xecjs-lib as a local dependency to allow easier testing of individual methods and how they interact with Cashtab

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ecpair-patching-stack
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 21148
Build 41948: Build Diffcashtab-tests
Build 41947: arc lint + arc unit

Event Timeline

Tail of the build log:

      src/utils/validation.js
      src/components/Common/ScanQRCode.js
      src/components/Common/EnhancedInputs.js
      src/components/Tokens/CreateTokenForm.js
      src/components/Tokens/__tests__/CreateTokenForm.test.js

    > 1 | var Buffer = require('safe-buffer').Buffer;
        |              ^
      2 | var bip66 = require('bip66');
      3 | var pushdata = require('@psf/pushdata-bitcoin');
      4 | var typeforce = require('typeforce');

      at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:324:11)
      at Object.<anonymous> (../xecjs-lib/src/script.js:1:14)
      at Object.<anonymous> (../xecjs-lib/src/index.js:1:14)
      at Object.<anonymous> (src/utils/cashMethods.js:12:1)
      at Object.<anonymous> (src/utils/validation.js:3:1)
      at Object.<anonymous> (src/components/Common/ScanQRCode.js:9:1)
      at Object.<anonymous> (src/components/Common/EnhancedInputs.js:9:1)
      at Object.<anonymous> (src/components/Tokens/CreateTokenForm.js:4:1)
      at Object.<anonymous> (src/components/Tokens/__tests__/CreateTokenForm.test.js:5:1)

FAIL src/components/Configure/__tests__/Configure.test.js
  ● Test suite failed to run

    Cannot find module 'safe-buffer' from '../xecjs-lib/src/script.js'

    Require stack:
      /work/web/xecjs-lib/src/script.js
      /work/web/xecjs-lib/src/index.js
      src/utils/cashMethods.js
      src/hooks/useBCH.js
      src/hooks/useWallet.js
      src/utils/context.js
      src/components/Configure/Configure.js
      src/components/Configure/__tests__/Configure.test.js

    > 1 | var Buffer = require('safe-buffer').Buffer;
        |              ^
      2 | var bip66 = require('bip66');
      3 | var pushdata = require('@psf/pushdata-bitcoin');
      4 | var typeforce = require('typeforce');

      at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:324:11)
      at Object.<anonymous> (../xecjs-lib/src/script.js:1:14)
      at Object.<anonymous> (../xecjs-lib/src/index.js:1:14)
      at Object.<anonymous> (src/utils/cashMethods.js:12:1)
      at Object.<anonymous> (src/hooks/useBCH.js:3:1)
      at Object.<anonymous> (src/hooks/useWallet.js:4:1)
      at Object.<anonymous> (src/utils/context.js:3:1)
      at Object.<anonymous> (src/components/Configure/Configure.js:29:1)
      at Object.<anonymous> (src/components/Configure/__tests__/Configure.test.js:5:1)


Test Suites: 17 failed, 4 passed, 21 total
Tests:       42 passed, 42 total
Snapshots:   2 passed, 2 total
Time:        10.389 s
Ran all test suites.
Build cashtab-tests failed with exit code 1

Issue is better resolved in webpack. May want to bring this into the monorepo later for further optimizations, but not on this stack.

Made obsolete by D12638