Page MenuHomePhabricator

[Cashtab] Update and implement jest setup file
ClosedPublic

Authored by bytesofman on Nov 6 2024, 19:49.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Commits
rABC01e5c51cec31: [Cashtab] Update and implement jest setup file
Summary

In the last diff where I made a jest setup file, I forgot to implement it (see jest.config.js change here).

It seemed to be working because we no longer needed all the Window prep work for tests to pass. But, this must be due to using a newer version of jest or react testing library, as the file written in that diff was not actually implemented. So I just removed those.

Here, we implement jest.setup.js, and remove the obsolete Window statements. We extend global mocks for bip39.

We are not able to mock recaptchav3 globally (used in Home and Rewards) because it requires a constant used in those tests.

Test Plan

npm test

grep -r "window.sideshift" src/ and no output from test mocks
grep -r "jest.mock('bip39'" src/ and no output

Diff Detail

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

Event Timeline

bytesofman published this revision for review.Nov 6 2024, 19:50

actually implement the setup file

bytesofman retitled this revision from [Cashtab] Back out bip39 mock from setup file to [Cashtab] Update and implement jest setup file.Nov 6 2024, 22:44
bytesofman edited the summary of this revision. (Show Details)
emack requested changes to this revision.EditedNov 7 2024, 10:09
emack added a subscriber: emack.

src/components/Swap/Swap.js: const sideshift = window.sideshift;

test should be no output related to unit tests right?

This revision now requires changes to proceed.Nov 7 2024, 10:09
bytesofman edited the test plan for this revision. (Show Details)

src/components/Swap/Swap.js: const sideshift = window.sideshift;

test should be no output related to unit tests right?

right, updated

we still use the variable in components

This revision is now accepted and ready to land.Nov 8 2024, 03:03