Page MenuHomePhabricator

[Cashtab] Update and implement jest setup file
ClosedPublic

Authored by bytesofman on Wed, Nov 6, 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
Branch
more-jest-fixes
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31048
Build 61598: Build Diffcashtab-tests
Build 61597: arc lint + arc unit

Event Timeline

bytesofman published this revision for review.Wed, Nov 6, 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.Wed, Nov 6, 22:44
bytesofman edited the summary of this revision. (Show Details)
emack requested changes to this revision.EditedThu, Nov 7, 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.Thu, Nov 7, 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.Fri, Nov 8, 03:03