Page MenuHomePhabricator

[e.cash] Update strapi scorecard data
ClosedPublic

Authored by johnkuney on Feb 14 2024, 15:33.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABC449dbe5ff499: [e.cash] Update strapi scorecard data
Summary

The strapi instance used on the get eCash page was migrated to v4.
This comes with some data structure changes to the endpoint that need to be adjusted for
Mainly all of the values are nested in an attributes object now, image structure, and there is a top level data object
Also updated the scores tests and made them easier to understand by removing the verbose mocks and instead opting
for a easy to understand mock within the test file

Test Plan

preview the site and check /get-ecash page. Should look the same
npm run test to run the tests

Diff Detail

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

Event Timeline

bytesofman added a subscriber: bytesofman.
bytesofman added inline comments.
web/e.cash/.env
3 ↗(On Diff #45240)

is this also STRAPI as the name implies?

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

This is no longer used anywhere in the app -- but it is not deleted

instead a variable of the same name with (presumably) a different structure is initialized in this test file.

So, two changes here.

1 - We stop using imported mocks and instead define them in the test file (could be reasons to do this)
2 - We use another mock of different shape

Difficult to review as I can't see in this diff how the mock has changed shape.

Please refactor so that the newly defined mocks simply overwrite the old ones in place. Then this diff will allow reviewer to see how the shape has changed.

If, afterwards, it seems like a good idea to keep the mocks in this file -- we can move it over. But it looks like the new mocks were defined in the test file while making the tests work, then the old mocks were never overwritten.

11–23 ↗(On Diff #45240)

same point for the other mocks no longer imported. If they are no longer used, delete from mocks file. If they have changed shape, then the shape change should take place in the mocks file.

This revision now requires changes to proceed.Feb 14 2024, 19:15
web/e.cash/.env
3 ↗(On Diff #45240)

yes its strapi too. Should I update them to STRAPI_SCORECARD_URL and STRAPI_BLOG_URL or something?
or something more specific and leave out strapi? EXCHANGE_DATA_ENDPOINT and BLOG_POSTS_ENDPOINT ?

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

exchangeScoringCriteria actually still is used in scores.js. Its what sets the scores. Was previously imported here to use to test the scoring function, but I opted to define a mock scoring criteria that is easier to digest in the test file

updating tests, removing mocks

@bot preview-e.cash

web/e.cash/.env
3 ↗(On Diff #45240)

lol no it's fine -- just checking to see if the name was copypasta from the one above.

This revision is now accepted and ready to land.Feb 14 2024, 22:40
This revision was automatically updated to reflect the committed changes.