ripple / explorer

Open Source XRP Ledger Explorer
https://livenet.xrpl.org/
MIT License
97 stars 62 forks source link

test: begin the switch to RTL #945

Open mvadari opened 4 months ago

mvadari commented 4 months ago

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, 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

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.

mvadari commented 3 months ago

Tests should be resolved by #972

mvadari commented 3 months ago

Opening this PR (finally) now that the testing issue has been resolved