55 IntrospectionNonNullTypeRef ,
66 IntrospectionNamedTypeRef ,
77 IntrospectionListTypeRef ,
8+ TypeKind ,
89} from "graphql" ;
910
1011import { MetadataStorage } from "../../src/metadata/metadata-storage" ;
@@ -159,27 +160,27 @@ describe("Fields - schema", () => {
159160 field => field . name === "implicitStringField" ,
160161 ) ! ;
161162
162- expect ( implicitStringField . type . kind ) . toEqual ( " NON_NULL" ) ;
163+ expect ( implicitStringField . type . kind ) . toEqual ( TypeKind . NON_NULL ) ;
163164 } ) ;
164165
165166 it ( "should generate implicit field type for scalar" , async ( ) => {
166167 const implicitStringFieldType = getInnerFieldType ( "implicitStringField" ) ;
167168
168- expect ( implicitStringFieldType . kind ) . toEqual ( " SCALAR" ) ;
169+ expect ( implicitStringFieldType . kind ) . toEqual ( TypeKind . SCALAR ) ;
169170 expect ( implicitStringFieldType . name ) . toEqual ( "String" ) ;
170171 } ) ;
171172
172173 it ( "should generate explicit field type for scalar" , async ( ) => {
173174 const explicitStringFieldType = getInnerFieldType ( "explicitStringField" ) ;
174175
175- expect ( explicitStringFieldType . kind ) . toEqual ( " SCALAR" ) ;
176+ expect ( explicitStringFieldType . kind ) . toEqual ( TypeKind . SCALAR ) ;
176177 expect ( explicitStringFieldType . name ) . toEqual ( "String" ) ;
177178 } ) ;
178179
179180 it ( "should generate implicit field type for object type" , async ( ) => {
180181 const implicitObjectFieldType = getInnerFieldType ( "implicitObjectField" ) ;
181182
182- expect ( implicitObjectFieldType . kind ) . toEqual ( " OBJECT" ) ;
183+ expect ( implicitObjectFieldType . kind ) . toEqual ( TypeKind . OBJECT ) ;
183184 expect ( implicitObjectFieldType . name ) . toEqual ( "SampleNestedObject" ) ;
184185 } ) ;
185186
@@ -191,7 +192,7 @@ describe("Fields - schema", () => {
191192 const implicitNullableStringFieldType =
192193 implicitNullableStringField . type as IntrospectionNamedTypeRef ;
193194
194- expect ( implicitNullableStringFieldType . kind ) . toEqual ( " SCALAR" ) ;
195+ expect ( implicitNullableStringFieldType . kind ) . toEqual ( TypeKind . SCALAR ) ;
195196 expect ( implicitNullableStringFieldType . name ) . toEqual ( "String" ) ;
196197 } ) ;
197198
@@ -203,7 +204,7 @@ describe("Fields - schema", () => {
203204 const explicitNullableStringFieldType =
204205 explicitNullableStringField . type as IntrospectionNamedTypeRef ;
205206
206- expect ( explicitNullableStringFieldType . kind ) . toEqual ( " SCALAR" ) ;
207+ expect ( explicitNullableStringFieldType . kind ) . toEqual ( TypeKind . SCALAR ) ;
207208 expect ( explicitNullableStringFieldType . name ) . toEqual ( "String" ) ;
208209 } ) ;
209210
@@ -216,10 +217,10 @@ describe("Fields - schema", () => {
216217 const arrayItemNonNullFieldType = arrayFieldType . ofType as IntrospectionNonNullTypeRef ;
217218 const arrayItemFieldType = arrayItemNonNullFieldType . ofType as IntrospectionNamedTypeRef ;
218219
219- expect ( nonNullFieldType . kind ) . toEqual ( " NON_NULL" ) ;
220- expect ( arrayFieldType . kind ) . toEqual ( " LIST" ) ;
221- expect ( arrayItemNonNullFieldType . kind ) . toEqual ( " NON_NULL" ) ;
222- expect ( arrayItemFieldType . kind ) . toEqual ( " SCALAR" ) ;
220+ expect ( nonNullFieldType . kind ) . toEqual ( TypeKind . NON_NULL ) ;
221+ expect ( arrayFieldType . kind ) . toEqual ( TypeKind . LIST ) ;
222+ expect ( arrayItemNonNullFieldType . kind ) . toEqual ( TypeKind . NON_NULL ) ;
223+ expect ( arrayItemFieldType . kind ) . toEqual ( TypeKind . SCALAR ) ;
223224 expect ( arrayItemFieldType . name ) . toEqual ( "String" ) ;
224225 } ) ;
225226
@@ -232,10 +233,10 @@ describe("Fields - schema", () => {
232233 const arrayItemNonNullFieldType = arrayFieldType . ofType as IntrospectionNonNullTypeRef ;
233234 const arrayItemFieldType = arrayItemNonNullFieldType . ofType as IntrospectionNamedTypeRef ;
234235
235- expect ( nonNullFieldType . kind ) . toEqual ( " NON_NULL" ) ;
236- expect ( arrayFieldType . kind ) . toEqual ( " LIST" ) ;
237- expect ( arrayItemNonNullFieldType . kind ) . toEqual ( " NON_NULL" ) ;
238- expect ( arrayItemFieldType . kind ) . toEqual ( " SCALAR" ) ;
236+ expect ( nonNullFieldType . kind ) . toEqual ( TypeKind . NON_NULL ) ;
237+ expect ( arrayFieldType . kind ) . toEqual ( TypeKind . LIST ) ;
238+ expect ( arrayItemNonNullFieldType . kind ) . toEqual ( TypeKind . NON_NULL ) ;
239+ expect ( arrayItemFieldType . kind ) . toEqual ( TypeKind . SCALAR ) ;
239240 expect ( arrayItemFieldType . name ) . toEqual ( "String" ) ;
240241 } ) ;
241242
@@ -245,9 +246,9 @@ describe("Fields - schema", () => {
245246 const arrayItemNonNullFieldType = arrayFieldType . ofType as IntrospectionNonNullTypeRef ;
246247 const arrayItemFieldType = arrayItemNonNullFieldType . ofType as IntrospectionNamedTypeRef ;
247248
248- expect ( arrayFieldType . kind ) . toEqual ( " LIST" ) ;
249- expect ( arrayItemNonNullFieldType . kind ) . toEqual ( " NON_NULL" ) ;
250- expect ( arrayItemFieldType . kind ) . toEqual ( " SCALAR" ) ;
249+ expect ( arrayFieldType . kind ) . toEqual ( TypeKind . LIST ) ;
250+ expect ( arrayItemNonNullFieldType . kind ) . toEqual ( TypeKind . NON_NULL ) ;
251+ expect ( arrayItemFieldType . kind ) . toEqual ( TypeKind . SCALAR ) ;
251252 expect ( arrayItemFieldType . name ) . toEqual ( "String" ) ;
252253 } ) ;
253254
@@ -259,9 +260,9 @@ describe("Fields - schema", () => {
259260 const arrayItemNonNullFieldType = arrayFieldType . ofType as IntrospectionNonNullTypeRef ;
260261 const arrayItemFieldType = arrayItemNonNullFieldType . ofType as IntrospectionNamedTypeRef ;
261262
262- expect ( arrayFieldType . kind ) . toEqual ( " LIST" ) ;
263- expect ( arrayItemNonNullFieldType . kind ) . toEqual ( " NON_NULL" ) ;
264- expect ( arrayItemFieldType . kind ) . toEqual ( " SCALAR" ) ;
263+ expect ( arrayFieldType . kind ) . toEqual ( TypeKind . LIST ) ;
264+ expect ( arrayItemNonNullFieldType . kind ) . toEqual ( TypeKind . NON_NULL ) ;
265+ expect ( arrayItemFieldType . kind ) . toEqual ( TypeKind . SCALAR ) ;
265266 expect ( arrayItemFieldType . name ) . toEqual ( "String" ) ;
266267 } ) ;
267268
@@ -274,9 +275,9 @@ describe("Fields - schema", () => {
274275 const arrayItemNonNullFieldType = arrayFieldType . ofType as IntrospectionNonNullTypeRef ;
275276 const arrayItemFieldType = arrayItemNonNullFieldType . ofType as IntrospectionNamedTypeRef ;
276277
277- expect ( arrayFieldType . kind ) . toEqual ( " LIST" ) ;
278- expect ( arrayItemNonNullFieldType . kind ) . toEqual ( " NON_NULL" ) ;
279- expect ( arrayItemFieldType . kind ) . toEqual ( " OBJECT" ) ;
278+ expect ( arrayFieldType . kind ) . toEqual ( TypeKind . LIST ) ;
279+ expect ( arrayItemNonNullFieldType . kind ) . toEqual ( TypeKind . NON_NULL ) ;
280+ expect ( arrayItemFieldType . kind ) . toEqual ( TypeKind . OBJECT ) ;
280281 expect ( arrayItemFieldType . name ) . toEqual ( "SampleNestedObject" ) ;
281282 } ) ;
282283} ) ;
0 commit comments