nusmodifications / nusmodifications/nusmods

Replace Enzyme with React Testing Library

Open
#3,033 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

better engineering good first issue
Dominant language
JavaScript
Stars
689
Forks
364
Avg merge
7h 5m
Merged PRs (30d)
14

Description

React Testing Library was added in #3007 so that it's easier to test components in context and from a user's perspective. It also feels like a much nicer API.

To avoid having 2 test libraries around (and the associated confusion and the effort needed to learn both), we'll want to replace Enzyme with React Testing Library. There are >30 remaining test files that use enzyme.

This issue tracks the removal of Enzyme from the codebase.

Work to resolve this should probably be done over multiple PRs as it's a rather large task. It may not be trivial since some of our tests test component implementation details and would need to be overhauled.

It may be best to see how React Testing Library is currently used in the codebase (and on the Internet, because we may be doing things wrong) and following that. There are some test utilities in our codebase that may help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inventorying the more than 30 remaining test files that use Enzyme, then inspect current React Testing Library usage and the existing test utilities. The work is done when the tests have been migrated across the planned PRs and Enzyme is removed from the codebase.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, testing
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.