Skip to content
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

Use react-hooks-testing-library to test hooks #1259

Merged
merged 2 commits into from Apr 25, 2019

Conversation

mpeyper
Copy link
Contributor

@mpeyper mpeyper commented Apr 24, 2019

For your consideration, I've updated the hook unit tests to use react-hooks-testing-library, which is similar to react-testing-library but with a focus on testing reuable hooks.

The only hook tests I left using actual components were the useSelector/lifeycle interactions and useSelector/performance optimizations and bail-outs tests as they seem to rely on the interplay between the Parent and Child components to work. I could probably hack something together to use the wrapper to simulate the relationship, but I felt that they are actually better in their current form as it more clearly describes the relationship between the interactions.

There are no hard feelings if you choose not to merge this and continue with the tests you have.

@netlify
Copy link

netlify bot commented Apr 24, 2019

Deploy preview for react-redux-docs ready!

Built with commit 83e84c4

https://deploy-preview-1259--react-redux-docs.netlify.com

package.json Show resolved Hide resolved
@timdorr
Copy link
Member

timdorr commented Apr 24, 2019

I like it! It definitely cleans things up a bit for a number of tests cases.

@timdorr
Copy link
Member

timdorr commented Apr 25, 2019

Perfect. Thanks!

@timdorr timdorr merged commit 756ae49 into reduxjs:v7-hooks-alpha Apr 25, 2019
timdorr pushed a commit that referenced this pull request May 30, 2019
* Use react-hooks-testing-library to test hooks

* Disable react/display-name rule with nested .eslintrc file
timdorr pushed a commit that referenced this pull request Jun 11, 2019
* Use react-hooks-testing-library to test hooks

* Disable react/display-name rule with nested .eslintrc file
webguru7 pushed a commit to webguru7/react-redux that referenced this pull request Dec 8, 2022
* Use react-hooks-testing-library to test hooks

* Disable react/display-name rule with nested .eslintrc file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants