File tree 2 files changed +16
-33
lines changed
2 files changed +16
-33
lines changed Original file line number Diff line number Diff line change @@ -538,29 +538,18 @@ type Query {
538
538
const ast = parse ( body ) ;
539
539
const schema = buildASTSchema ( ast ) ;
540
540
541
- expect ( schema . getType ( 'MyEnum' ) . getValues ( ) ) . to . deep . equal ( [
542
- {
543
- name : 'VALUE' ,
544
- description : '' ,
545
- isDeprecated : false ,
546
- deprecationReason : undefined ,
547
- value : 'VALUE'
548
- } ,
549
- {
550
- name : 'OLD_VALUE' ,
551
- description : '' ,
552
- isDeprecated : true ,
553
- deprecationReason : 'No longer supported' ,
554
- value : 'OLD_VALUE'
555
- } ,
556
- {
557
- name : 'OTHER_VALUE' ,
558
- description : '' ,
559
- isDeprecated : true ,
560
- deprecationReason : 'Terrible reasons' ,
561
- value : 'OTHER_VALUE'
562
- }
563
- ] ) ;
541
+ const myEnum = schema . getType ( 'MyEnum' ) ;
542
+
543
+ const value = myEnum . getValue ( 'VALUE' ) ;
544
+ expect ( value . isDeprecated ) . to . equal ( false ) ;
545
+
546
+ const oldValue = myEnum . getValue ( 'OLD_VALUE' ) ;
547
+ expect ( oldValue . isDeprecated ) . to . equal ( true ) ;
548
+ expect ( oldValue . deprecationReason ) . to . equal ( 'No longer supported' ) ;
549
+
550
+ const otherValue = myEnum . getValue ( 'OTHER_VALUE' ) ;
551
+ expect ( otherValue . isDeprecated ) . to . equal ( true ) ;
552
+ expect ( otherValue . deprecationReason ) . to . equal ( 'Terrible reasons' ) ;
564
553
565
554
const rootFields = schema . getType ( 'Query' ) . getFields ( ) ;
566
555
expect ( rootFields . field1 . isDeprecated ) . to . equal ( true ) ;
Original file line number Diff line number Diff line change @@ -214,16 +214,10 @@ union SomeUnion = Foo | Biz
214
214
expect ( deprecatedFieldDef . deprecationReason ) . to . equal ( 'not used anymore' ) ;
215
215
216
216
const deprecatedEnumDef = extendedSchema
217
- . getType ( 'EnumWithDeprecatedValue' ) ;
218
- expect ( deprecatedEnumDef . getValues ( ) ) . to . deep . equal ( [
219
- {
220
- name : 'DEPRECATED' ,
221
- description : '' ,
222
- isDeprecated : true ,
223
- deprecationReason : 'do not use' ,
224
- value : 'DEPRECATED'
225
- }
226
- ] ) ;
217
+ . getType ( 'EnumWithDeprecatedValue' )
218
+ . getValue ( 'DEPRECATED' ) ;
219
+ expect ( deprecatedEnumDef . isDeprecated ) . to . equal ( true ) ;
220
+ expect ( deprecatedEnumDef . deprecationReason ) . to . equal ( 'do not use' ) ;
227
221
} ) ;
228
222
229
223
it ( 'extends objects with deprecated fields' , ( ) => {
You can’t perform that action at this time.
0 commit comments