Page MenuHomePhabricator

[e.cash] Filter out low exchange scores
ClosedPublic

Authored by johnkuney on Oct 31 2023, 04:59.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC3142a9c245dc: [e.cash] Filter out low exchange scores
Summary

As discussed adding some logic to scores.js to filter out scores below a certain threshold (60 for now)
Updated the test data to reflect this and modified a test so it would pass

Test Plan

Preview the site and check items on the get-ecash page with low scores are gone
check all test pass - npm run test

Diff Detail

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

Event Timeline

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.

Looks good on the preview

web/e.cash/data/__tests__/scores.test.js
155 ↗(On Diff #42865)

Is this change related to the score cutoff change?

web/e.cash/data/scores.js
154 ↗(On Diff #42865)

Maybe it's just me, but the comment seems a bit confusing.

I see that's how it's implemented, but the comment doesn't make it obvious that score is the primary sorting, alphabetically only factors in when the other stuff is equal.

Fabien requested changes to this revision.Oct 31 2023, 14:21
Fabien added a subscriber: Fabien.
Fabien added inline comments.
web/e.cash/data/scores.js
158 ↗(On Diff #42865)

There is no test for this sort function. You certainly want to move the threshold to some config file, pass it as a parameter to this sort function and add a unit test to check the behavior.

This revision now requires changes to proceed.Oct 31 2023, 14:21

edit comments, add scorethreshold as a parameter and update tests

Okay added, I couldnt think of a better place to put the scoreThreshold than at the top of scores.js, but open to suggestions

And as far as that other test change in getScoreCardData, I added it here because the sort change was causing that test to fail as it was

Fabien requested changes to this revision.Nov 2 2023, 11:16

The unit test needs to give confidence the code is working, not only testing the happy path (as per telegram discussion)

This revision now requires changes to proceed.Nov 2 2023, 11:16

add more robust unit test

Very nice ! That is a great unit tests which is easy to read, understand and review.

This revision is now accepted and ready to land.Nov 3 2023, 13:51
This revision was automatically updated to reflect the committed changes.