This PR introduces the React Testing Library (RTL) to the Explorer's testing system, beginning the rollout of replacing Enzyme. It is a more modern testing library, and supports later versions of React.
Three test files are switched over to use RTL: Account, Currency, and Amount.
Only tests are affected by this change.
Context of Change
This switch is necessary to upgrade to React v18 (#668), which has a lot of features that would clean up the codebase a lot. Enzyme stopped supporting React at v16, and even v17 support requires a hacky adapter.
This PR replaces #530 - merge commits got messy and complicated, and it was easier to re-apply all the changes to the updated codebase.
Type of Change
[x] Tests (You added tests for code that already exists, or your new feature included in this PR)
Codebase Modernization
[ ] Updated files to React Hooks
[ ] Updated files to TypeScript
[x] Updated tests to React Testing Library
Test Plan
Tests pass locally and in CI.
Future Tasks
There are a total of 149 test files - not all of them use enzyme, but most do. This PR switches 3 of them over to RTL, to provide a template. The rest of the enzyme tests still need to be switched over.
A script could likely be written to handle most of the migration.
High Level Overview of Change
This PR introduces the React Testing Library (RTL) to the Explorer's testing system, beginning the rollout of replacing Enzyme. It is a more modern testing library, and supports later versions of React.
Three test files are switched over to use RTL:
Account
,Currency
, andAmount
.Only tests are affected by this change.
Context of Change
This switch is necessary to upgrade to React v18 (#668), which has a lot of features that would clean up the codebase a lot. Enzyme stopped supporting React at v16, and even v17 support requires a hacky adapter.
This PR replaces #530 - merge commits got messy and complicated, and it was easier to re-apply all the changes to the updated codebase.
Type of Change
Codebase Modernization
Test Plan
Tests pass locally and in CI.
Future Tasks
There are a total of 149 test files - not all of them use enzyme, but most do. This PR switches 3 of them over to RTL, to provide a template. The rest of the enzyme tests still need to be switched over.
A script could likely be written to handle most of the migration.