@@ -43,6 +43,18 @@ const simpleMutationWithDescription = mutationWithClientMutationId({
43
43
mutateAndGetPayload : ( ) => ( { result : 1 } )
44
44
} ) ;
45
45
46
+ const simpleMutationWithDeprecationReason = mutationWithClientMutationId ( {
47
+ name : 'SimpleMutationWithDeprecationReason' ,
48
+ inputFields : { } ,
49
+ outputFields : {
50
+ result : {
51
+ type : GraphQLInt
52
+ }
53
+ } ,
54
+ mutateAndGetPayload : ( ) => ( { result : 1 } ) ,
55
+ deprecationReason : 'Just because'
56
+ } ) ;
57
+
46
58
const simpleMutationWithThunkFields = mutationWithClientMutationId ( {
47
59
name : 'SimpleMutationWithThunkFields' ,
48
60
inputFields : ( ) => ( {
@@ -92,6 +104,7 @@ const mutationType = new GraphQLObjectType({
92
104
fields : {
93
105
simpleMutation,
94
106
simpleMutationWithDescription,
107
+ simpleMutationWithDeprecationReason,
95
108
simpleMutationWithThunkFields,
96
109
simplePromiseMutation,
97
110
simpleRootValueMutation,
@@ -145,7 +158,7 @@ describe('mutationWithClientMutationId()', () => {
145
158
} ) ;
146
159
} ) ;
147
160
148
- it ( 'Supports thunks as input and output fields' , async ( ) => {
161
+ it ( 'supports thunks as input and output fields' , async ( ) => {
149
162
const query = `
150
163
mutation M {
151
164
simpleMutationWithThunkFields(input: {
@@ -465,5 +478,60 @@ describe('mutationWithClientMutationId()', () => {
465
478
}
466
479
} ) ;
467
480
} ) ;
481
+
482
+ it ( 'contains correct deprecation reasons' , async ( ) => {
483
+ const query = `{
484
+ __schema {
485
+ mutationType {
486
+ fields(includeDeprecated: true) {
487
+ name
488
+ isDeprecated
489
+ deprecationReason
490
+ }
491
+ }
492
+ }
493
+ }` ;
494
+
495
+ return expect ( await graphql ( schema , query ) ) . to . deep . equal ( {
496
+ data : {
497
+ __schema : {
498
+ mutationType : {
499
+ fields : [
500
+ {
501
+ name : 'simpleMutation' ,
502
+ isDeprecated : false ,
503
+ deprecationReason : null
504
+ } ,
505
+ {
506
+ name : 'simpleMutationWithDescription' ,
507
+ isDeprecated : false ,
508
+ deprecationReason : null
509
+ } ,
510
+ {
511
+ name : 'simpleMutationWithDeprecationReason' ,
512
+ isDeprecated : true ,
513
+ deprecationReason : 'Just because' ,
514
+ } ,
515
+ {
516
+ name : 'simpleMutationWithThunkFields' ,
517
+ isDeprecated : false ,
518
+ deprecationReason : null
519
+ } ,
520
+ {
521
+ name : 'simplePromiseMutation' ,
522
+ isDeprecated : false ,
523
+ deprecationReason : null
524
+ } ,
525
+ {
526
+ name : 'simpleRootValueMutation' ,
527
+ isDeprecated : false ,
528
+ deprecationReason : null
529
+ }
530
+ ]
531
+ }
532
+ }
533
+ }
534
+ } ) ;
535
+ } ) ;
468
536
} ) ;
469
537
} ) ;
0 commit comments