graphql-mock
graphql-mock copied to clipboard
mutation mocking with .fail throws an error with apollo hooks
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
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