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

Migrate away from @testing-library/react-hooks #10415

Merged

Conversation

alessbell
Copy link
Contributor

@alessbell alessbell commented Jan 6, 2023

Closes #10333. Many thanks to @eps1lon for the foundation of this PR originating in eps1lon#1 🙏

To Do

  • uncomment and rewrite two tests in hooks/__tests__/useQuery.test.tsx which rely on deprecated result.all API
  • fix 1 skipped test in hooks/__tests__/useLazyQuery.test.tsx
  • fix 1 failing test in React 18 (passing with 17) in hooks/__tests__/useQuery.test.tsx

Checklist:

  • If this PR contains changes to the library itself (not necessary for e.g. docs updates), please include a changeset (see CONTRIBUTING.md)
  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests

@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2023

⚠️ No Changeset found

Latest commit: dc6dafa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

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

Thank you SO SO much for doing this. Super great not to have to remember which renderHook we are using 😄.

Feel free to address/ignore the [nit] comments. There were a couple tests in here that might result in test flake, or false positives with the use of waitFor. I'm happy to approve once we determine if there is an issue there or not.

src/react/hooks/__tests__/useLazyQuery.test.tsx Outdated Show resolved Hide resolved
src/react/hooks/__tests__/useLazyQuery.test.tsx Outdated Show resolved Hide resolved
src/react/hooks/__tests__/useLazyQuery.test.tsx Outdated Show resolved Hide resolved
src/react/hooks/__tests__/useLazyQuery.test.tsx Outdated Show resolved Hide resolved
src/react/hooks/__tests__/useMutation.test.tsx Outdated Show resolved Hide resolved
src/react/hooks/__tests__/useQuery.test.tsx Outdated Show resolved Hide resolved
src/react/hooks/__tests__/useQuery.test.tsx Outdated Show resolved Hide resolved
src/react/hooks/__tests__/useQuery.test.tsx Outdated Show resolved Hide resolved
@alessbell
Copy link
Contributor Author

Thanks for the review, @jerelmiller! This is ready for a final pass—mostly minor fixes, with one call-out for the changes in 6d1a204, the least straightforward test refactor in the PR.

Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

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

💯 💯 Nice work! Love when we can reduce dependencies. Thanks so much for doing this for us!

@jerelmiller jerelmiller merged commit 1b694f1 into main Jan 9, 2023
@jerelmiller jerelmiller deleted the issue-10333-migrate-away-from-testing-library-react-hooks branch January 9, 2023 19:41
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate tests from @testing-library/react-hooks to @testing-library/react
2 participants