Page MenuHomePhabricator

[herald] Simplify price api to add specific urls to mocks
ClosedPublic

Authored by bytesofman on Nov 22 2023, 02:29.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCd567420ad146: [herald] Simplify price api to add specific urls to mocks
Summary

Price API is designed to support any possible crypto. Cool feature that we never use.

I'm looking to add another API request to handleBlockConnected to show peerName for avalanche staking rewards. However, all the unit tests have been lazily designed with just a single mock axios that does not specify a URL.

In order to specify the URL, need to have a simple way of getting it from config, so that if we do change the config and list of currencies, we don't need to change this hardcoded mock everywhere.

So, simplify to the point of making the URL extraction a one-liner. Then update the axios mocks to reference this URL.

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.Nov 22 2023, 08:55
Fabien added a subscriber: Fabien.
Fabien added inline comments.
apps/ecash-herald/test/events.test.js
171 ↗(On Diff #43210)

Make it a function to avoid the duplicate

This revision now requires changes to proceed.Nov 22 2023, 08:55

move url creation to helper function to avoid repeating long one-liner

This revision is now accepted and ready to land.Nov 23 2023, 09:20