Page MenuHomePhabricator

[cashtab] Fix broken tests which rendered antd Input components after jest 27 upgrade
ClosedPublic

Authored by alcipir on Mar 25 2022, 01:34.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABC1909a08f731e: [cashtab] Fix broken tests which rendered antd Input components after jest 27…
Summary

Depends on D11255. This diff refactors the broken tests by wrapping the rendered components in a WalletContext Provider with a mocked value, instead of mocking the useContext hook, which was interfering with child components that used the same hook, causing the tests to fail.

Test Plan

npm install
npm test

All tests should pass.

Diff Detail

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

Event Timeline

Owners added a reviewer: Restricted Owners Package.Mar 25 2022, 01:34
alcipir requested review of this revision.Mar 25 2022, 01:34

Please apply this same fix to the other snapshot test files:

Airdrop.test.js, Configure.test.js, Home.test.js, and Receive.test.js

This revision now requires changes to proceed.Mar 25 2022, 16:20

Applying the same changes to AirDrop, Configure, Home and Receive tests

This revision is now accepted and ready to land.Mar 25 2022, 16:45