File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -274,11 +274,18 @@ Works for any nested selections (data) and any nested inputs (variables).
274
274
It will include ` __typename ` in data by default. This can be deactivated as an option:
275
275
276
276
``` js
277
- apolloMock (documentNode, variables, data , { addTypename: false });
277
+ apolloMock (documentNode, variables, result , { addTypename: false });
278
278
```
279
279
280
280
When used together with ` codegenTypedDocuments ` the data and variables are type checked (type inference).
281
281
282
+ To mock errors, you can provide ` errors ` in ` result ` (` GraphQLError ` ) or pass an ` Error ` instead of ` result ` :
283
+
284
+ ``` js
285
+ apolloMock (documentNode, variables, { errors: [new GraphQLError (" Already exists" )] });
286
+ apolloMock (documentNode, variables, new Error (" Network error" ));
287
+ ```
288
+
282
289
### Install
283
290
284
291
``` sh
You can’t perform that action at this time.
0 commit comments