You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+15
Original file line number
Diff line number
Diff line change
@@ -276,6 +276,21 @@ const cache = new InMemoryCache({
276
276
const mockClient =createMockClient({ cache });
277
277
```
278
278
279
+
Additionally, you can specify a `missingHandlerPolicy` to define the behavior of the mock client when a request handler for a particular operation is not found.
280
+
281
+
The `missingHandlerPolicy` accepts one of three string values:
282
+
-`'throw-error'`: The client throws an error when it encounters a missing handler.
283
+
-`'warn-and-return-error'`: The client logs a warning message in the console and returns an error.
284
+
-`'return-error'`: The client returns an error without any warning message.
285
+
286
+
Here's an example of how you can set the `missingHandlerPolicy`:
In this example, if a request handler for a given operation is not found, the client will log a warning message to the console and then return an error.
293
+
279
294
Note: it is not possible to specify the `link` to use as this is how `mock-apollo-client` injects its behaviour.
0 commit comments