@@ -31,6 +31,18 @@ var simpleMutation = mutationWithClientMutationId({
31
31
mutateAndGetPayload : ( ) => ( { result : 1 } )
32
32
} ) ;
33
33
34
+ var 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
var simpleMutationWithThunkFields = mutationWithClientMutationId ( {
35
47
name : 'SimpleMutationWithThunkFields' ,
36
48
inputFields : ( ) => ( {
@@ -61,6 +73,7 @@ var mutation = new GraphQLObjectType({
61
73
name : 'Mutation' ,
62
74
fields : {
63
75
simpleMutation : simpleMutation ,
76
+ simpleMutationWithDescription : simpleMutationWithDescription ,
64
77
simpleMutationWithThunkFields : simpleMutationWithThunkFields ,
65
78
simplePromiseMutation : simplePromiseMutation
66
79
}
@@ -285,6 +298,26 @@ describe('mutationWithClientMutationId()', () => {
285
298
kind : 'OBJECT' ,
286
299
}
287
300
} ,
301
+ {
302
+ name : 'simpleMutationWithDescription' ,
303
+ args : [
304
+ {
305
+ name : 'input' ,
306
+ type : {
307
+ name : null ,
308
+ kind : 'NON_NULL' ,
309
+ ofType : {
310
+ name : 'SimpleMutationWithDescriptionInput' ,
311
+ kind : 'INPUT_OBJECT'
312
+ }
313
+ } ,
314
+ }
315
+ ] ,
316
+ type : {
317
+ name : 'SimpleMutationWithDescriptionPayload' ,
318
+ kind : 'OBJECT' ,
319
+ }
320
+ } ,
288
321
{
289
322
name : 'simpleMutationWithThunkFields' ,
290
323
args : [
@@ -332,5 +365,44 @@ describe('mutationWithClientMutationId()', () => {
332
365
333
366
return expect ( graphql ( schema , query ) ) . to . become ( { data : expected } ) ;
334
367
} ) ;
368
+
369
+ it ( 'contains correct descriptions' , ( ) => {
370
+ var query = `{
371
+ __schema {
372
+ mutationType {
373
+ fields {
374
+ name
375
+ description
376
+ }
377
+ }
378
+ }
379
+ }` ;
380
+ var expected = {
381
+ __schema : {
382
+ mutationType : {
383
+ fields : [
384
+ {
385
+ name : 'simpleMutation' ,
386
+ description : ''
387
+ } ,
388
+ {
389
+ name : 'simpleMutationWithDescription' ,
390
+ description : 'Simple Mutation Description'
391
+ } ,
392
+ {
393
+ name : 'simpleMutationWithThunkFields' ,
394
+ description : ''
395
+ } ,
396
+ {
397
+ name : 'simplePromiseMutation' ,
398
+ description : ''
399
+ } ,
400
+ ]
401
+ }
402
+ }
403
+ } ;
404
+
405
+ return expect ( graphql ( schema , query ) ) . to . become ( { data : expected } ) ;
406
+ } ) ;
335
407
} ) ;
336
408
} ) ;
0 commit comments