File tree 2 files changed +24
-4
lines changed
2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,26 @@ describe('mutationWithClientMutationId()', () => {
206
206
} ) ;
207
207
} ) ;
208
208
209
+ it ( 'supports mutations returning null' , async ( ) => {
210
+ const query = `
211
+ mutation M {
212
+ simpleRootValueMutation(input: {clientMutationId: "abc"}) {
213
+ result
214
+ clientMutationId
215
+ }
216
+ }
217
+ ` ;
218
+
219
+ expect ( await graphql ( schema , query , null ) ) . to . deep . equal ( {
220
+ data : {
221
+ simpleRootValueMutation : {
222
+ result : null ,
223
+ clientMutationId : 'abc' ,
224
+ } ,
225
+ } ,
226
+ } ) ;
227
+ } ) ;
228
+
209
229
describe ( 'introspection' , ( ) => {
210
230
it ( 'contains correct input' , async ( ) => {
211
231
const query = `
Original file line number Diff line number Diff line change @@ -98,10 +98,10 @@ export function mutationWithClientMutationId(
98
98
} ,
99
99
resolve : ( _ , { input } , context , info ) =>
100
100
Promise . resolve ( mutateAndGetPayload ( input , context , info ) ) . then (
101
- ( payload ) => {
102
- payload . clientMutationId = input . clientMutationId ;
103
- return payload ;
104
- } ,
101
+ ( payload ) => ( {
102
+ ... payload ,
103
+ clientMutationId : input . clientMutationId ,
104
+ } ) ,
105
105
) ,
106
106
} ;
107
107
}
You can’t perform that action at this time.
0 commit comments