Nock is used for testing and mocking http requests in Node. Integrating
graphql-mocks with Nock is easy with
@graphql-mocks/network-nock npm packages.
In any Nock POST
.reply(), use the
nockHandler with a
nockHandler function also accepts an
options argument, an object with
These callbacks are useful for doing checks or additional assertions during testing
checkRequestcallback is passed the incoming
checkGraphQLResultcallback is passed the result from the GraphQLHandler
With the above nock handler setup, a
node-fetch call will be intercepted by and responded to from nock and graphql-mocks.
See the GraphQL docs for details on these body parameters, and making http requests.
The Nock request object is made available within the resolver
context under the
See the API Documentation for types and more details.