LaunchPadLab / lp-components

Our Components
http://lp-components.herokuapp.com
MIT License
5 stars 1 forks source link

Migrate enzyme to testing library #586

Closed josiasds closed 9 months ago

josiasds commented 1 year ago

This PR contains the migration from enzyme to react-testing-library, as requested in #567.

From the docs:

Testing Library has a different approach to testing when compared to Enzyme. What that means is there's not a one-to-one mapping of Enzyme features to React Testing Library features.

React Testing Library encourages you to avoid testing implementation details like the internals of a component you're testing (though it's still possible). The Guiding Principles of this library emphasize a focus on tests that closely resemble how your web pages are interacted by the users.

You may want to avoid the following implementation details:

  • Internal state of a component
  • Internal methods of a component
  • Lifecycle methods of a component
  • Child components

Release Notes

Author Checklist

Components to migrate: 100%

josiasds commented 10 months ago

@chawes13 I updated all the files currently in this PR and addressed all comments. Let me know your thoughts, and then we can merge the separate PRs into this branch.

chawes13 commented 10 months ago

@josiasds I merged the latest release on main into and migrated color picker tests. LMK what else you need from me!

josiasds commented 10 months ago

@chawes13 I can't approve this PR since I'm the author, but it's ready!

chawes13 commented 10 months ago

Thanks @josiasds! I want to fix the test coverage regression before we officially go-live with this. I'll tackle that first thing when I'm back 🙂

josiasds commented 10 months ago

@chawes13 I just reviewed your latest changes, looking good. Mocking isServer is the best approach in my opinion.

chawes13 commented 10 months ago

@josiasds Ready for ya! We got to 100% coverage 😎