graphql-mock icon indicating copy to clipboard operation
graphql-mock copied to clipboard

mutation mocking with .fail throws an error with apollo hooks

Open s-taylor opened this issue 4 years ago • 1 comments

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 avatar Mar 04 '20 23:03 s-taylor

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

s-taylor avatar Jul 01 '20 00:07 s-taylor