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 rerender props in wrapper #1284

Open
jjoselv opened this issue Mar 7, 2024 · 1 comment
Open

use rerender props in wrapper #1284

jjoselv opened this issue Mar 7, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jjoselv
Copy link

jjoselv commented Mar 7, 2024

Describe the feature you'd like:

I would like to be able to test a re-render with a different wrapper.
The use case is to ensure that returned callbacks of the tested hook are changed when a new wrapper is used.

Mimic what was added in the testing-library/react-hooks-testing-library in testing-library/react-hooks-testing-library#381

Additionally, update the types of wrapper.

Suggested implementation:

I can't manage to modify pure.js to convey this.

Describe alternatives you've considered:


Teachability, Documentation, Adoption, Migration Strategy:


@eps1lon
Copy link
Member

eps1lon commented Mar 9, 2024

It should be a different option. It's just confusing to pass the same props to both the hook and the wrapper component. Especially from a type perspective this is a nightmare.

The requested API is especially odd since we don't seem to need it for component testing. I'm inclined to recommend to people to write a test component instead and test that with render. renderHook was really just a convenience wrapper for the 90% not a 1st class testing API.

@eps1lon eps1lon added the enhancement New feature or request label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants