Mocks plugin
A simple plugin for adding resolver mocks to a GraphQL schema.
Usage
Install
Setup
Adding mocks
You can mock any field by adding a mock in the options passed to builder.toSchema
under
mocks.{typeName}.{fieldName}
.
Mocks will replace the resolve functions any time a mocked field is executed. A schema can be built multiple times with different mocks.
Adding mocks for subscribe functions
To add a mock for a subscriber you can nest the mocks for subscribe and resolve in an object: