Page MenuHomePhabricator

[chronik-client] Sub and unsub to and from addresses for websocket
ClosedPublic

Authored by bytesofman on Mar 2 2024, 22:20.

Details

Summary

Implement sub and unsub to address methods for chronik-client and mock-chronik-client

Test Plan

CI

Diff Detail

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

Event Timeline

Tail of the build log:

  npm audit fix --force

Run `npm audit` for details.

> ecash-herald@1.0.0 test
> mocha --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/ecash-herald-junit.xml --reporter-options testsuitesTitle=Ecash Herald Unit Tests --reporter-options rootSuiteTitle=Ecash Herald


Error: Cannot find module 'ecashaddrjs'
Require stack:
- /work/apps/mock-chronik-client/index.js
- /work/apps/ecash-herald/test/chronik.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/ecash-herald/test/chronik.test.js:6:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/ecash-herald/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/ecash-herald/node_modules/mocha/lib/cli/run.js:370:5)
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='0']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/ecash-herald-junit.xml': No such file or directory
Build ecash-herald-tests failed with exit code 1

Tail of the build log:

- /work/apps/examples/test/sendXec.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/examples/test/sendXec.test.js:20:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/examples/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/examples/node_modules/mocha/lib/cli/run.js:370:5)
-----------------------------|---------|----------|---------|---------|-------------------
File                         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-----------------------------|---------|----------|---------|---------|-------------------
All files                    |   49.26 |    11.11 |   44.44 |    49.5 |                   
 mocks                       |    3.22 |        0 |       0 |    3.22 |                   
  chronikMock.js             |    1.63 |        0 |       0 |    1.63 | 11-160            
  chronikResponses.js        |     100 |      100 |     100 |     100 |                   
 scripts                     |    69.5 |       25 |   88.88 |      70 |                   
  createWallet.js            |     100 |      100 |     100 |     100 |                   
  getDetailsFromTxid.js      |      80 |      100 |     100 |      80 | 20,35             
  getTokenDetails.js         |      80 |      100 |     100 |      80 | 20,34             
  getTxHistoryFromAddress.js |   73.33 |      100 |     100 |   73.33 | 29-36,58          
  getUtxosFromAddress.js     |      75 |      100 |     100 |      75 | 30-32,47          
  listenForConfirmation.js   |      50 |        0 |      50 |      50 | 18-45             
  sendXec.js                 |      60 |     37.5 |     100 |   61.11 | 69-146,205,233    
-----------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='100']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='203']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='27']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='16']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='36']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='100']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='202']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/examples-junit.xml': No such file or directory
Build app-dev-examples failed with exit code 1

Tail of the build log:

- /work/apps/mock-chronik-client/index.js
- /work/apps/alias-server/test/chronik.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/alias-server/test/chronik.test.js:16:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/alias-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/alias-server/node_modules/mocha/lib/cli/run.js:370:5)
------------------------|---------|----------|---------|---------|-------------------
File                    | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------------------|---------|----------|---------|---------|-------------------
All files               |    7.77 |        0 |       0 |    7.98 |                   
 alias-server           |     100 |      100 |     100 |     100 |                   
  config.js             |     100 |      100 |     100 |     100 |                   
 alias-server/constants |     100 |      100 |     100 |     100 |                   
  alias.js              |     100 |      100 |     100 |     100 |                   
 alias-server/src       |    7.27 |        0 |       0 |    7.47 |                   
  alias.js              |    5.88 |        0 |       0 |    6.06 | 23-369            
  app.js                |   16.66 |        0 |       0 |   16.66 | 23-183            
  chronik.js            |    4.47 |        0 |       0 |    4.76 | 12-196            
  db.js                 |    6.09 |        0 |       0 |    6.09 | 17-308            
  utils.js              |       5 |        0 |       0 |    5.26 | 12-160            
------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='29']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='373']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='140']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='40']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='29']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='363']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/alias-server-junit.xml': No such file or directory
Build alias-server-tests failed with exit code 1

Tail of the build log:

found 0 vulnerabilities

> token-server@0.0.0 test
> mocha --recursive --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/token-server-junit.xml --reporter-options testsuitesTitle=Token Server Unit Tests --reporter-options rootSuiteTitle=Token Server


Error: Cannot find module 'ecashaddrjs'
Require stack:
- /work/apps/mock-chronik-client/index.js
- /work/apps/token-server/test/chronik/wsHandler.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/token-server/test/chronik/wsHandler.test.js:8:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/token-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/token-server/node_modules/mocha/lib/cli/run.js:370:5)
--------------|---------|----------|---------|---------|-------------------
File          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
--------------|---------|----------|---------|---------|-------------------
All files     |   33.33 |      100 |       0 |   33.33 |                   
 wsHandler.js |   33.33 |      100 |       0 |   33.33 | 13-22,30          
--------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='9']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='9']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/token-server-junit.xml': No such file or directory
Build token-server-tests failed with exit code 1

Tail of the build log:

      8 |     MockChronikClient: class {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (../apps/mock-chronik-client/index.js:5:18)
      at Object.require (src/components/fixtures/helpers.js:5:1)
      at Object.require (src/components/Etokens/__tests__/CreateToken.test.js:10:1)

FAIL src/hooks/__tests__/useWallet.test.js
  โ— Test suite failed to run

    Cannot find module 'ecashaddrjs' from '../apps/mock-chronik-client/index.js'

    Require stack:
      /work/apps/mock-chronik-client/index.js
      src/components/fixtures/helpers.js
      src/hooks/__tests__/useWallet.test.js

      3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
      4 | 'use strict';
    > 5 | const cashaddr = require('ecashaddrjs');
        |                  ^
      6 |
      7 | module.exports = {
      8 |     MockChronikClient: class {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (../apps/mock-chronik-client/index.js:5:18)
      at Object.require (src/components/fixtures/helpers.js:5:1)
      at Object.require (src/hooks/__tests__/useWallet.test.js:18:1)

FAIL src/components/fixtures/__tests__/CashtabTestWrapper.test.js
  โ— Test suite failed to run

    Cannot find module 'ecashaddrjs' from '../apps/mock-chronik-client/index.js'

    Require stack:
      /work/apps/mock-chronik-client/index.js
      src/components/fixtures/helpers.js
      src/components/fixtures/__tests__/CashtabTestWrapper.test.js

      3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
      4 | 'use strict';
    > 5 | const cashaddr = require('ecashaddrjs');
        |                  ^
      6 |
      7 | module.exports = {
      8 |     MockChronikClient: class {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (../apps/mock-chronik-client/index.js:5:18)
      at Object.require (src/components/fixtures/helpers.js:5:1)
      at Object.require (src/components/fixtures/__tests__/CashtabTestWrapper.test.js:13:1)


Test Suites: 15 failed, 13 passed, 28 total
Tests:       482 passed, 482 total
Snapshots:   0 total
Time:        11.921 s
Ran all test suites.
Build cashtab-tests failed with exit code 1

relative import issue in mock-chronik-client

update ecashaddrjs, export it, call the exported object

Tail of the build log:

  npm audit fix --force

Run `npm audit` for details.

> ecash-herald@1.0.0 test
> mocha --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/ecash-herald-junit.xml --reporter-options testsuitesTitle=Ecash Herald Unit Tests --reporter-options rootSuiteTitle=Ecash Herald


Error: Cannot find module 'ecashaddrjs'
Require stack:
- /work/apps/mock-chronik-client/index.js
- /work/apps/ecash-herald/test/chronik.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/ecash-herald/test/chronik.test.js:6:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/ecash-herald/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/ecash-herald/node_modules/mocha/lib/cli/run.js:370:5)
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='0']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/ecash-herald-junit.xml': No such file or directory
Build ecash-herald-tests failed with exit code 1

Tail of the build log:

- /work/apps/mock-chronik-client/index.js
- /work/apps/alias-server/test/chronik.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/alias-server/test/chronik.test.js:16:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/alias-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/alias-server/node_modules/mocha/lib/cli/run.js:370:5)
------------------------|---------|----------|---------|---------|-------------------
File                    | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------------------|---------|----------|---------|---------|-------------------
All files               |    7.77 |        0 |       0 |    7.98 |                   
 alias-server           |     100 |      100 |     100 |     100 |                   
  config.js             |     100 |      100 |     100 |     100 |                   
 alias-server/constants |     100 |      100 |     100 |     100 |                   
  alias.js              |     100 |      100 |     100 |     100 |                   
 alias-server/src       |    7.27 |        0 |       0 |    7.47 |                   
  alias.js              |    5.88 |        0 |       0 |    6.06 | 23-369            
  app.js                |   16.66 |        0 |       0 |   16.66 | 23-183            
  chronik.js            |    4.47 |        0 |       0 |    4.76 | 12-196            
  db.js                 |    6.09 |        0 |       0 |    6.09 | 17-308            
  utils.js              |       5 |        0 |       0 |    5.26 | 12-160            
------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='29']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='373']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='140']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='40']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='29']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='363']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/alias-server-junit.xml': No such file or directory
Build alias-server-tests failed with exit code 1

Tail of the build log:

found 0 vulnerabilities

> token-server@0.0.0 test
> mocha --recursive --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/token-server-junit.xml --reporter-options testsuitesTitle=Token Server Unit Tests --reporter-options rootSuiteTitle=Token Server


Error: Cannot find module 'ecashaddrjs'
Require stack:
- /work/apps/mock-chronik-client/index.js
- /work/apps/token-server/test/chronik/wsHandler.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/token-server/test/chronik/wsHandler.test.js:8:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/token-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/token-server/node_modules/mocha/lib/cli/run.js:370:5)
--------------|---------|----------|---------|---------|-------------------
File          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
--------------|---------|----------|---------|---------|-------------------
All files     |   33.33 |      100 |       0 |   33.33 |                   
 wsHandler.js |   33.33 |      100 |       0 |   33.33 | 13-22,30          
--------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='9']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='9']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/token-server-junit.xml': No such file or directory
Build token-server-tests failed with exit code 1

Tail of the build log:

      8 |     MockChronikClient: class {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (../apps/mock-chronik-client/index.js:5:18)
      at Object.require (src/components/fixtures/helpers.js:5:1)
      at Object.require (src/components/Etokens/__tests__/CreateToken.test.js:10:1)

FAIL src/hooks/__tests__/useWallet.test.js
  โ— Test suite failed to run

    Cannot find module 'ecashaddrjs' from '../apps/mock-chronik-client/index.js'

    Require stack:
      /work/apps/mock-chronik-client/index.js
      src/components/fixtures/helpers.js
      src/hooks/__tests__/useWallet.test.js

      3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
      4 | 'use strict';
    > 5 | const cashaddr = require('ecashaddrjs');
        |                  ^
      6 |
      7 | module.exports = {
      8 |     MockChronikClient: class {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (../apps/mock-chronik-client/index.js:5:18)
      at Object.require (src/components/fixtures/helpers.js:5:1)
      at Object.require (src/hooks/__tests__/useWallet.test.js:18:1)

FAIL src/components/fixtures/__tests__/CashtabTestWrapper.test.js
  โ— Test suite failed to run

    Cannot find module 'ecashaddrjs' from '../apps/mock-chronik-client/index.js'

    Require stack:
      /work/apps/mock-chronik-client/index.js
      src/components/fixtures/helpers.js
      src/components/fixtures/__tests__/CashtabTestWrapper.test.js

      3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
      4 | 'use strict';
    > 5 | const cashaddr = require('ecashaddrjs');
        |                  ^
      6 |
      7 | module.exports = {
      8 |     MockChronikClient: class {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (../apps/mock-chronik-client/index.js:5:18)
      at Object.require (src/components/fixtures/helpers.js:5:1)
      at Object.require (src/components/fixtures/__tests__/CashtabTestWrapper.test.js:13:1)


Test Suites: 15 failed, 13 passed, 28 total
Tests:       482 passed, 482 total
Snapshots:   0 total
Time:        11.906 s
Ran all test suites.
Build cashtab-tests failed with exit code 1

Tail of the build log:

- /work/apps/examples/test/sendXec.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/examples/test/sendXec.test.js:20:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/examples/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/examples/node_modules/mocha/lib/cli/run.js:370:5)
-----------------------------|---------|----------|---------|---------|-------------------
File                         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-----------------------------|---------|----------|---------|---------|-------------------
All files                    |   49.26 |    11.11 |   44.44 |    49.5 |                   
 mocks                       |    3.22 |        0 |       0 |    3.22 |                   
  chronikMock.js             |    1.63 |        0 |       0 |    1.63 | 11-160            
  chronikResponses.js        |     100 |      100 |     100 |     100 |                   
 scripts                     |    69.5 |       25 |   88.88 |      70 |                   
  createWallet.js            |     100 |      100 |     100 |     100 |                   
  getDetailsFromTxid.js      |      80 |      100 |     100 |      80 | 20,35             
  getTokenDetails.js         |      80 |      100 |     100 |      80 | 20,34             
  getTxHistoryFromAddress.js |   73.33 |      100 |     100 |   73.33 | 29-36,58          
  getUtxosFromAddress.js     |      75 |      100 |     100 |      75 | 30-32,47          
  listenForConfirmation.js   |      50 |        0 |      50 |      50 | 18-45             
  sendXec.js                 |      60 |     37.5 |     100 |   61.11 | 69-146,205,233    
-----------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='100']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='203']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='27']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='16']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='36']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='100']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='202']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/examples-junit.xml': No such file or directory
Build app-dev-examples failed with exit code 1
  • Remove mock-chronik-client change from this diff
  • mock-chronik-client needs to be its own npm package D15613
  • add sub/unsub to and from addresses to mock-chronik-client D15613
  • Remove mock-chronik-client change from this diff
  • mock-chronik-client needs to be its own npm package D15613
  • add sub/unsub to and from addresses to mock-chronik-client D15613

mock-chronik-client should be an npm pkg anyway, all of the relative imports from the monorepo are confusing

imo this diff does not need to be held up by mock-chronik-client issues

emack requested changes to this revision.Mar 2 2024, 23:33
emack added a subscriber: emack.
emack added inline comments.
modules/chronik-client/test/integration/websocket.ts
331 โ†—(On Diff #45864)

Needs a final check to verify it has resubscribed all ok

expect(ws.subs).to.deep.equal([
    { scriptType: 'p2pkh', payload: p2pkhHash },
]);
This revision now requires changes to proceed.Mar 2 2024, 23:33
bytesofman added inline comments.
modules/chronik-client/test/integration/websocket.ts
331 โ†—(On Diff #45864)

this is not repeated as this functionality (calling subscribe impacts a class variable in ws) is already tested above.

That it is truly resubscribed is confirmed by the below tests passing (we would not get any block or script msgs if we were not subscribed).

This revision is now accepted and ready to land.Mar 3 2024, 03:27