Page MenuHomePhabricator

[tg bot] Improve how mocks are generated and stored
ClosedPublic

Authored by bytesofman on Apr 7 2023, 22:32.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCf842e2dbcd76: [tg bot] Improve how mocks are generated and stored
Summary

T2972

Depends on D13623

It's been a persistent headache that generateMocks uses slightly different syntax / functions than what is used in the app. Some differences are necessary to preserve blockNames, which are useful in developer review and keeping track of why some blocks are mocked. But, in general, we want to be sure that the mocks are generated in exactly the same way that the app is running.

This diff refactors generateMocks to use the new handleBlockConnected function, modified with an optional flag to return mocks.

Test Plan

npm test

Diff Detail

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

Event Timeline

Fabien requested changes to this revision.Apr 9 2023, 07:05
Fabien added a subscriber: Fabien.
Fabien added inline comments.
apps/ecash-herald/scripts/generateMocks.js
138 ↗(On Diff #39417)

it's no big deal if we don't have the copyright notice on test data (this is not code we need to protect) but add a @generated mark

This revision now requires changes to proceed.Apr 9 2023, 07:05
bytesofman added inline comments.
apps/ecash-herald/scripts/generateMocks.js
138 ↗(On Diff #39417)

Added @generated

Leaving the header as it's more complicated to remove this lint rule for just this file than to keep it generally

bytesofman marked an inline comment as done.

rebase

This revision is now accepted and ready to land.Apr 10 2023, 18:56