federation-testing-tool icon indicating copy to clipboard operation
federation-testing-tool copied to clipboard

Asserting error responses

Open nijk opened this issue 4 years ago • 1 comments

I'm trying to understand if it is possible to use this library to assert on error responses from a resolver. My use case is:

I have a resolver which calls an upstream process, if that process throws an error, then my resolver throws an ApolloError. I want to be able to test that an ApolloError has been thrown under the correct conditions.

The problem I have at the moment is that this library throws it's own error because the response is not in a shape it expects for a successful response, e.g.

Expected Iterable, but did not find one for field "Query.fieldName".

nijk avatar Nov 04 '21 15:11 nijk

Having had a look through the code, it appears that if the subgraph response includes the errors property, then this library throws its own error which masks the underlying error thrown by the subgraph. Making it impossible to test the errors thrown by a subgraph.

I'm happy to submit a PR if you would consider it?

nijk avatar Nov 11 '21 17:11 nijk