Page MenuHomePhabricator

[Cashtab][Alias] Add chronik mock
ClosedPublic

Authored by emack on Jul 31 2023, 23:07.

Details

Reviewers
bytesofman
Fabien
Group Reviewers
Restricted Project
Commits
rABC144e5d653d92: [Cashtab][Alias] Add chronik mock
Summary

T3216

This diff separates out the chronik mock from D14325 and updates the registerNewAlias unit tests to be ready for websocket behaviors in D14325.

Test Plan

npm test

Diff Detail

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

Event Timeline

emack requested review of this revision.Jul 31 2023, 23:07
bytesofman added inline comments.
cashtab/src/utils/__mocks__/chronikMock.js
8 ↗(On Diff #41655)

limit the logic added here to only what you need for the websocket tests

we have a lot of chronik unit tests in cashtab that should use the mock. Understandably beyond the scope of this diff. difficult to review the mock when it's just dumped in and not implemented.

Can add to this as its implemented in other existing unit tests.

This revision now requires changes to proceed.Jul 31 2023, 23:20
emack marked an inline comment as done.

Limiting chronik mock to broadcastTx and websocket logic

bytesofman added inline comments.
cashtab/src/utils/__tests__/transactions.test.js
116 ↗(On Diff #41656)

why mock this with jest? you have included this method in MockChronikClient, where it can be set by the setMock method

If jest is a better way to do it in Cashtab, don't include these methods in the mock

This revision now requires changes to proceed.Jul 31 2023, 23:37
emack marked an inline comment as done.

Removed broadcastTx methods from mock chronik as the jest approach is more realistic

This revision is now accepted and ready to land.Aug 1 2023, 16:35
This revision was automatically updated to reflect the committed changes.