File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,33 @@ describe('Type System: Example', () => {
184
184
} ) ;
185
185
} ) ;
186
186
187
+ it ( 'defines an enum type with a value of `null` and `undefined`' , ( ) => {
188
+ const EnumTypeWithNullishValue = new GraphQLEnumType ( {
189
+ name : 'EnumWithNullishValue' ,
190
+ values : {
191
+ NULL : { value : null } ,
192
+ UNDEFINED : { value : undefined } ,
193
+ }
194
+ } ) ;
195
+
196
+ expect ( EnumTypeWithNullishValue . getValues ( ) ) . to . deep . equal ( [
197
+ {
198
+ name : 'NULL' ,
199
+ description : undefined ,
200
+ isDeprecated : false ,
201
+ deprecationReason : undefined ,
202
+ value : null ,
203
+ } ,
204
+ {
205
+ name : 'UNDEFINED' ,
206
+ description : undefined ,
207
+ isDeprecated : false ,
208
+ deprecationReason : undefined ,
209
+ value : undefined ,
210
+ } ,
211
+ ] ) ;
212
+ } ) ;
213
+
187
214
it ( 'defines an object type with deprecated field' , ( ) => {
188
215
const TypeWithDeprecatedField = new GraphQLObjectType ( {
189
216
name : 'foo' ,
Original file line number Diff line number Diff line change @@ -984,7 +984,7 @@ function defineEnumValues(
984
984
description : value . description ,
985
985
isDeprecated : Boolean ( value . deprecationReason ) ,
986
986
deprecationReason : value . deprecationReason ,
987
- value : isNullish ( value . value ) ? valueName : value . value ,
987
+ value : value . hasOwnProperty ( ' value' ) ? value . value : valueName ,
988
988
} ;
989
989
} ) ;
990
990
}
You can’t perform that action at this time.
0 commit comments