@@ -31,6 +31,18 @@ const simpleMutation = mutationWithClientMutationId({
31
31
mutateAndGetPayload : ( ) => ( { result : 1 } )
32
32
} ) ;
33
33
34
+ const simpleMutationWithDescription = mutationWithClientMutationId ( {
35
+ name : 'SimpleMutationWithDescription' ,
36
+ description : 'Simple Mutation Description' ,
37
+ inputFields : { } ,
38
+ outputFields : {
39
+ result : {
40
+ type : GraphQLInt
41
+ }
42
+ } ,
43
+ mutateAndGetPayload : ( ) => ( { result : 1 } )
44
+ } ) ;
45
+
34
46
const simpleMutationWithThunkFields = mutationWithClientMutationId ( {
35
47
name : 'SimpleMutationWithThunkFields' ,
36
48
inputFields : ( ) => ( {
@@ -79,6 +91,7 @@ const mutationType = new GraphQLObjectType({
79
91
name : 'Mutation' ,
80
92
fields : {
81
93
simpleMutation,
94
+ simpleMutationWithDescription,
82
95
simpleMutationWithThunkFields,
83
96
simplePromiseMutation,
84
97
simpleRootValueMutation,
@@ -322,6 +335,26 @@ describe('mutationWithClientMutationId()', () => {
322
335
kind : 'OBJECT' ,
323
336
}
324
337
} ,
338
+ {
339
+ name : 'simpleMutationWithDescription' ,
340
+ args : [
341
+ {
342
+ name : 'input' ,
343
+ type : {
344
+ name : null ,
345
+ kind : 'NON_NULL' ,
346
+ ofType : {
347
+ name : 'SimpleMutationWithDescriptionInput' ,
348
+ kind : 'INPUT_OBJECT'
349
+ }
350
+ } ,
351
+ }
352
+ ] ,
353
+ type : {
354
+ name : 'SimpleMutationWithDescriptionPayload' ,
355
+ kind : 'OBJECT' ,
356
+ }
357
+ } ,
325
358
{
326
359
name : 'simpleMutationWithThunkFields' ,
327
360
args : [
@@ -388,5 +421,49 @@ describe('mutationWithClientMutationId()', () => {
388
421
}
389
422
} ) ;
390
423
} ) ;
424
+
425
+ it ( 'contains correct descriptions' , async ( ) => {
426
+ const query = `{
427
+ __schema {
428
+ mutationType {
429
+ fields {
430
+ name
431
+ description
432
+ }
433
+ }
434
+ }
435
+ }` ;
436
+
437
+ return expect ( await graphql ( schema , query ) ) . to . deep . equal ( {
438
+ data : {
439
+ __schema : {
440
+ mutationType : {
441
+ fields : [
442
+ {
443
+ name : 'simpleMutation' ,
444
+ description : null
445
+ } ,
446
+ {
447
+ name : 'simpleMutationWithDescription' ,
448
+ description : 'Simple Mutation Description'
449
+ } ,
450
+ {
451
+ name : 'simpleMutationWithThunkFields' ,
452
+ description : null
453
+ } ,
454
+ {
455
+ name : 'simplePromiseMutation' ,
456
+ description : null
457
+ } ,
458
+ {
459
+ name : 'simpleRootValueMutation' ,
460
+ description : null
461
+ }
462
+ ]
463
+ }
464
+ }
465
+ }
466
+ } ) ;
467
+ } ) ;
391
468
} ) ;
392
469
} ) ;
0 commit comments