kaievns / graphql-mock

A client side GraphQL mocking library
61 stars 15 forks source link

mutation mocking with .fail throws an error with apollo hooks #26

Open s-taylor opened 4 years ago

s-taylor commented 4 years ago

When using useMutation and mocking this via graphQL mock to fail (.fail('...')), the result is an error is thrown. But when a graphQL error normally occurs with useMutation no error is thrown, the error is just returned via the error variable.

In the tests this isn't occuring because there is a { onError: noop } passed to the useMutation hook. But this shouldn't be necessary and is masking the problem.

https://github.com/MadRabbit/graphql-mock/blob/master/test/mutations_test.tsx#L41

s-taylor commented 4 years ago

So it seems like this might be expected apollo behaviour, and update to apollo deps may fix it though 🤷‍♂️

https://github.com/apollographql/apollo-client/issues/5708#issuecomment-569754975