Okay lets try to ask here. Is there an example of ...
# pact-js
m
Okay lets try to ask here. Is there an example of how to use Pact with
useQuery
Apollo hook? Cannot seem to find any on github or in the docs.
t
I thought the graphql example did this- does it not?
m
Which one?
t
Oh wait, you mean the react hook?
m
yes
t
There isn't an example with that
m
I made it work but it was a deep dive into react 🙂
Maybe I can add example to pact-js cause its way more complex than expected
especially with v3
t
That hook seems like an anti pattern to me. Typically (whether or not you use graphql or pact) you would separate the API layer from the hooks
Like, how would you test it without pact?
m
Using
MockedProvider
t
I don't think that part is the hard part
But I've never tried to do it
I'm sure an example would be welcome
m
That’s not its all the funk around waitFor I didn’t use before 🙂
t
Oof
m
Cause we need to wait for useQuery to actually do the work
t
Yep
m
learned a lot about RTL in the process 🙂
t
I’m definitely keen to see what you came up with, because then I’ll learn something too
And people are going to use that hook, whether or not I think it's an anti-pattern
😆 1
😅 1