-
Notifications
You must be signed in to change notification settings - Fork 18
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
Bind mocked provider #129
Bind mocked provider #129
Conversation
724ca6e
to
e610dc4
Compare
@Arnarkari93 I've got a couple questions on this PR. Is it ready for review? |
Yes, it's ready for review. Did you have some other approach to bind this in mind? |
Well, I haven't loaded up much in my head yet, but doesn't mocked provider use some react context to provide an apollo client? And in #112, you point out that the client needs these extra properties like Are you saying we can just bind to |
Ahh, now I remember what was. These bindings will be limited to testing components that use only hooks. If the component tries to directly perform an operation on the apollo client it will try to execute the |
Rather then binding mocked provider we want to create a apollo client by calling the rescript method so that methods like `rescript_query` are available on the client https://github.com/apollographql/apollo-client/blob/main/src/testing/react/MockedProvider.tsx
I have updated the PR and recreated the |
Thank you, this looks great! I'm going to merge a bit later today. If you want to add a comment in |
Yes, no problem. I can add it now. |
This is now published in v2.3.0. Thank you so much for working on this! |
What
Create
<MockedProvider />
in rescript.Why
rescript_query
that are added to the client instance are available.Js.Json.t
so that we are writing to the apollo cache since cannot write variants to the cache.null
andundefined
when writing to the cache.None
translates toundefined
How
makeResult
method that takes intoJson
method that knows how to serialize back toJs.Json.t
. That method is generated as a part of the graphql ppx