@@ -29,6 +29,7 @@ import {
29
29
getSubscriptionByName ,
30
30
} from '../utils/introspection-schema.utils' ;
31
31
import { printedSchemaSnapshot } from '../utils/printed-schema.snapshot' ;
32
+ import { CatsResolver } from '../code-first/cats/cats.resolver' ;
32
33
33
34
describe ( 'Code-first - schema factory' , ( ) => {
34
35
let schemaFactory : GraphQLSchemaFactory ;
@@ -50,6 +51,7 @@ describe('Code-first - schema factory', () => {
50
51
[
51
52
RecipesResolver ,
52
53
DirectionsResolver ,
54
+ CatsResolver ,
53
55
AbstractResolver ,
54
56
IRecipesResolver ,
55
57
] ,
@@ -68,17 +70,18 @@ describe('Code-first - schema factory', () => {
68
70
printedSchemaSnapshot ,
69
71
) ;
70
72
} ) ;
71
- it ( 'should define 5 queries' , async ( ) => {
73
+ it ( 'should define 6 queries' , async ( ) => {
72
74
const type = getQuery ( introspectionSchema ) ;
73
75
74
- expect ( type . fields . length ) . toEqual ( 5 ) ;
76
+ expect ( type . fields . length ) . toEqual ( 6 ) ;
75
77
expect ( type . fields . map ( ( item ) => item . name ) ) . toEqual (
76
78
expect . arrayContaining ( [
77
79
'recipes' ,
78
80
'search' ,
79
81
'categories' ,
80
82
'move' ,
81
83
'recipe' ,
84
+ 'catType' ,
82
85
] ) ,
83
86
) ;
84
87
} ) ;
@@ -154,6 +157,40 @@ describe('Code-first - schema factory', () => {
154
157
) ;
155
158
} ) ;
156
159
160
+ it ( 'should define "CatType" enum to use CAPITALIZED_UNDERSCORE' , ( ) => {
161
+ const type = introspectionSchema . types . find (
162
+ ( { name } ) => name === 'CatType' ,
163
+ ) ;
164
+
165
+ expect ( type ) . toEqual (
166
+ expect . objectContaining ( {
167
+ kind : TypeKind . ENUM ,
168
+ name : 'CatType' ,
169
+ description : 'Distinguish cats' ,
170
+ enumValues : [
171
+ {
172
+ deprecationReason : null ,
173
+ description : null ,
174
+ isDeprecated : false ,
175
+ name : 'PERSIAN_CAT' ,
176
+ } ,
177
+ {
178
+ deprecationReason : null ,
179
+ description : null ,
180
+ isDeprecated : false ,
181
+ name : 'MAINE_COON' ,
182
+ } ,
183
+ {
184
+ deprecationReason : null ,
185
+ description : null ,
186
+ isDeprecated : false ,
187
+ name : 'RAGDOLL' ,
188
+ } ,
189
+ ] ,
190
+ } ) ,
191
+ ) ;
192
+ } ) ;
193
+
157
194
it ( 'should define "SearchResultUnion" union' , ( ) => {
158
195
const type = introspectionSchema . types . find (
159
196
( { name } ) => name === 'SearchResultUnion' ,
0 commit comments