Skip to content

Migrate out of Enzyme testing library to facilitate react 18 upgrade #2524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 21, 2023

Conversation

chownces
Copy link
Contributor

@chownces chownces commented Jun 20, 2023

Description

See #2520

Moving forward, we should probably document down the best practices while onboarding new developers, and point them to the relevant documentation to get started (e.g. React 18, @ testing-library/react, etc.) --> added in #2527

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How to test

Check through the snapshots. I've tried adding some assertions to the snapshot tests too to improve the robustness of the test suite.

Checklist

  • I have tested this code

@chownces chownces self-assigned this Jun 20, 2023
@chownces chownces added the blocking Finishing this opens up other stuff label Jun 20, 2023
@chownces chownces force-pushed the react-testing-lib-migration branch from 7ddcc91 to 9db5769 Compare June 20, 2023 18:52
@RichDom2185 RichDom2185 self-requested a review June 21, 2023 08:51
@chownces chownces marked this pull request as ready for review June 21, 2023 09:21
@chownces chownces linked an issue Jun 21, 2023 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Jun 21, 2023

Pull Request Test Coverage Report for Build 5333112029

  • 28 of 28 (100.0%) changed or added relevant lines in 8 files are covered.
  • 7 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.1%) to 36.494%

Files with Coverage Reduction New Missed Lines %
src/commons/mocks/BackendMocks.ts 1 13.5%
src/commons/sagas/SafeEffects.ts 1 79.41%
src/commons/utils/JsSlangHelper.ts 1 63.75%
src/commons/sideContent/SideContentContestVoting.tsx 4 62.07%
Totals Coverage Status
Change from base Build 5318910390: 0.1%
Covered Lines: 5267
Relevant Lines: 13577

💛 - Coveralls

Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all this refactoring work, much appreciated! I only have a few minor nits below, otherwise LGTM 😄

@chownces chownces enabled auto-merge (squash) June 21, 2023 10:44
@chownces chownces merged commit b2b7ec6 into master Jun 21, 2023
@chownces chownces deleted the react-testing-lib-migration branch June 21, 2023 10:49
RichDom2185 pushed a commit to NUS-CS1101S/cadet-frontend that referenced this pull request Jul 15, 2023
…ource-academy#2524)

* Add testing-library/react packages

* Downgrade react-test-renderer to match current react version

* Deprecate enzyme usage

* Downgrade @test-library/react to match react version

* Continue deprecation of enzyme usage

* Migrate Assessment.tsx tests

* Migrate dialogs and dropdown tests

* Migrate navigation bar tests

* Migrate NotificationBadge tests

* Migrate profile card tests

* Migrate Repl, RessearchAgreementPrompt and SideContentAutograder tests

* Migrate remaining side content component tests

* Migrate Sicp component tests

* Migrate AssessmentWorkspace component tests

* Update remaining snapshots after changes

* Shift extend-expect import to setup file

* Remove enzyme related packages

* Fix PR comments
RichDom2185 pushed a commit to NUS-CS1101S/cadet-frontend that referenced this pull request Aug 15, 2023
…ource-academy#2524)

* Add testing-library/react packages

* Downgrade react-test-renderer to match current react version

* Deprecate enzyme usage

* Downgrade @test-library/react to match react version

* Continue deprecation of enzyme usage

* Migrate Assessment.tsx tests

* Migrate dialogs and dropdown tests

* Migrate navigation bar tests

* Migrate NotificationBadge tests

* Migrate profile card tests

* Migrate Repl, RessearchAgreementPrompt and SideContentAutograder tests

* Migrate remaining side content component tests

* Migrate Sicp component tests

* Migrate AssessmentWorkspace component tests

* Update remaining snapshots after changes

* Shift extend-expect import to setup file

* Remove enzyme related packages

* Fix PR comments
@coveralls
Copy link

coveralls commented Sep 22, 2024

Pull Request Test Coverage Report for Build 5332350829

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 28 of 28 (100.0%) changed or added relevant lines in 8 files are covered.
  • 7 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.1%) to 36.494%

Files with Coverage Reduction New Missed Lines %
src/commons/mocks/BackendMocks.ts 1 13.5%
src/commons/sagas/SafeEffects.ts 1 79.41%
src/commons/utils/JsSlangHelper.ts 1 63.75%
src/commons/sideContent/SideContentContestVoting.tsx 4 62.07%
Totals Coverage Status
Change from base Build 5318910390: 0.1%
Covered Lines: 5267
Relevant Lines: 13577

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocking Finishing this opens up other stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate out of enzyme testing library for React18 upgrade
3 participants