@@ -43,6 +43,18 @@ const simpleMutationWithDescription = mutationWithClientMutationId({
4343 mutateAndGetPayload : ( ) => ( { result : 1 } )
4444} ) ;
4545
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+
4658const simpleMutationWithThunkFields = mutationWithClientMutationId ( {
4759 name : 'SimpleMutationWithThunkFields' ,
4860 inputFields : ( ) => ( {
@@ -92,6 +104,7 @@ const mutationType = new GraphQLObjectType({
92104 fields : {
93105 simpleMutation,
94106 simpleMutationWithDescription,
107+ simpleMutationWithDeprecationReason,
95108 simpleMutationWithThunkFields,
96109 simplePromiseMutation,
97110 simpleRootValueMutation,
@@ -145,7 +158,7 @@ describe('mutationWithClientMutationId()', () => {
145158 } ) ;
146159 } ) ;
147160
148- it ( 'Supports thunks as input and output fields' , async ( ) => {
161+ it ( 'supports thunks as input and output fields' , async ( ) => {
149162 const query = `
150163 mutation M {
151164 simpleMutationWithThunkFields(input: {
@@ -465,5 +478,60 @@ describe('mutationWithClientMutationId()', () => {
465478 }
466479 } ) ;
467480 } ) ;
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+ } ) ;
468536 } ) ;
469537} ) ;
0 commit comments