feat: add renderHook function by pierrezimmermannbam · Pull Request #923 · callstack/react-native-testing-library (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation8 Commits4 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Summary
This pr provides a basic implementation of renderHook as requested in #869. The solution is almost a copy past from the one made in react testing library
Test plan
Some test cases were added, also inspired from the implementation from react testing library
The @testing-library/react
PR still hasn't been merged, so I'd like for it to be merged first before getting that in. I'm monitoring said PR, but don't hesitate to ping me once it's merged if I miss it.
The RTL PR has been merged now. Please let me know if there is anything I can do to progress this.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm working on migrating to typescript, I'll add documentation afterwards, it shouldn't take long
It's done, there is a typing issue because the option param is optional so initialProps may not be defined when it needs to be but changing the typing would mean having a different api from the one of react-hooks-testing-library and I'm not sure it's something we want.
I also added documentation, I used the documentation I found on the react-hooks-testing-library repo and added some examples
Member
thymikee left a comment • Loading
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed some documentation updates. Looks pretty!