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

Adding an integration test for query hooks. #30

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tarehart
Copy link

@tarehart tarehart commented Dec 9, 2023

Closes #

🎯 Changes

This adds a description in the README for how to mock useQuery hooks from @trpc/react-query, and an integration test to verify.

I also updated the package lock, the @trpc/* dependencies had been stuck on 10.9.0 for a long time. Now they'll end up being 10.44.0 for fresh installs of msw-trpc.

This is related to the issue #28

✅ Checklist

  • [✅] If necessary, I have added documentation related to the changes made.
  • [✅] I have added or updated the tests related to the changes made.

@tarehart
Copy link
Author

tarehart commented Dec 9, 2023

Thinking more about it, I think I was unwise with the way I bumped the dependency. Should be something like > 10.9 and < 11. I'll update

Edit: done

@maloguertin
Copy link
Owner

I'm not against this PR at all but it is still unclear to me if the bug that is reported in the issue is reproducible and what it is related to. I think that if it is specifically related to vitest + trpc 10.33.1 we should maybe just add this as a troubleshoot section in the doc instead.

@tarehart
Copy link
Author

Yes, the bug is reproducible by taking the code in this PR and commenting out import 'whatwg-fetch' in setup.ts.

I no longer think it's related to vitest, but I'm confident that trpc 10.33.1 began the need for some kind of fetch polyfill. I haven't taken the time to truly find the root cause.

I don't mind if this goes in a troubleshooting section, but I think it's valuable in the 'usage' section because it advertises that msw-trpc works with @trpc/react-query, and it might help people avoid the pitfall in the first place.

Maybe I could modify the integration test to be more self-contained / self-explanatory, and make the README link to it as an example?

@vafanassieff vafanassieff mentioned this pull request Apr 24, 2024
2 tasks
@maloguertin
Copy link
Owner

maloguertin commented Aug 9, 2024

@tarehart sorry for the really long delay, this is a fine PR, I will merge it :)

if you could fix the conflicts I'd appreciate it.

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.

2 participants