@@ -33,7 +33,7 @@ beforeAll(() => UserModel.base.connect());
3333afterAll ( ( ) => UserModel . base . disconnect ( ) ) ;
3434
3535describe ( 'fieldConverter' , ( ) => {
36- const fields = getFieldsFromModel ( UserModel ) ;
36+ const fields : { [ key : string ] : any } = getFieldsFromModel ( UserModel ) ;
3737 const fieldNames = Object . keys ( fields ) ;
3838
3939 describe ( 'getFieldsFromModel()' , ( ) => {
@@ -48,12 +48,12 @@ describe('fieldConverter', () => {
4848
4949 it ( 'should throw Exception, if model does `schema.path` property' , ( ) => {
5050 expect ( ( ) => {
51- // $FlowFixMe
52- getFieldsFromModel ( { a : 1 } ) ;
51+ const wrongArgs : any = [ { a : 1 } ] ;
52+ getFieldsFromModel ( ... wrongArgs ) ;
5353 } ) . toThrowError ( / i n c o r r e c t m o n g o o s e m o d e l / ) ;
5454 expect ( ( ) => {
55- // $FlowFixMe
56- getFieldsFromModel ( { schema : { } } ) ;
55+ const wrongArgs : any = [ { schema : { } } ] ;
56+ getFieldsFromModel ( ... wrongArgs ) ;
5757 } ) . toThrowError ( / i n c o r r e c t m o n g o o s e m o d e l / ) ;
5858 } ) ;
5959 } ) ;
@@ -62,20 +62,20 @@ describe('fieldConverter', () => {
6262 it ( 'should throw error on incorrect mongoose field' , ( ) => {
6363 const err = / i n c o r r e c t m o n g o o s e f i e l d / ;
6464 expect ( ( ) => {
65- // $FlowFixMe
66- deriveComplexType ( ) ;
65+ const wrongArgs : any = [ ] ;
66+ deriveComplexType ( ... wrongArgs ) ;
6767 } ) . toThrowError ( err ) ;
6868 expect ( ( ) => {
69- // $FlowFixMe
70- deriveComplexType ( 123 ) ;
69+ const wrongArgs : any = [ 123 ] ;
70+ deriveComplexType ( ... wrongArgs ) ;
7171 } ) . toThrowError ( err ) ;
7272 expect ( ( ) => {
73- // $FlowFixMe
74- deriveComplexType ( { a : 1 } ) ;
73+ const wrongArgs : any = [ { a : 1 } ] ;
74+ deriveComplexType ( ... wrongArgs ) ;
7575 } ) . toThrowError ( err ) ;
7676 expect ( ( ) => {
77- // $FlowFixMe
78- deriveComplexType ( { path : 'name' } ) ;
77+ const wrongArgs : any = [ { path : 'name' } ] ;
78+ deriveComplexType ( ... wrongArgs ) ;
7979 } ) . toThrowError ( err ) ;
8080 expect ( ( ) => {
8181 deriveComplexType ( { path : 'name' , instance : 'Abc' } ) ;
@@ -99,9 +99,7 @@ describe('fieldConverter', () => {
9999
100100 it ( 'schould derive ENUM' , ( ) => {
101101 expect ( deriveComplexType ( fields . gender ) ) . toBe ( ComplexTypes . ENUM ) ;
102- // $FlowFixMe
103102 expect ( deriveComplexType ( fields . languages . schema . paths . ln ) ) . toBe ( ComplexTypes . ENUM ) ;
104- // $FlowFixMe
105103 expect ( deriveComplexType ( fields . languages . schema . paths . sk ) ) . toBe ( ComplexTypes . ENUM ) ;
106104 } ) ;
107105
@@ -156,8 +154,7 @@ describe('fieldConverter', () => {
156154 } ) ;
157155
158156 it ( 'should has string in ofType' , ( ) => {
159- const skillsType = arrayToGraphQL ( fields . skills ) ;
160- // $FlowFixMe
157+ const skillsType : any = arrayToGraphQL ( fields . skills ) ;
161158 expect ( skillsType . ofType . name ) . toBe ( 'String' ) ;
162159 } ) ;
163160 } ) ;
@@ -174,10 +171,8 @@ describe('fieldConverter', () => {
174171 } ) ;
175172
176173 it ( 'should pass all enum values to GQ type' , ( ) => {
177- const genderEnum = enumToGraphQL ( fields . gender ) ;
178- // $FlowFixMe
174+ const genderEnum : any = enumToGraphQL ( fields . gender ) ;
179175 expect ( genderEnum . _values . length ) . toBe ( fields . gender . enumValues . length ) ;
180- // $FlowFixMe
181176 expect ( genderEnum . _values [ 0 ] . value ) . toBe ( fields . gender . enumValues [ 0 ] ) ;
182177 } ) ;
183178 } ) ;
@@ -189,8 +184,7 @@ describe('fieldConverter', () => {
189184 } ) ;
190185
191186 it ( 'should have embedded fields' , ( ) => {
192- const embeddedType = embeddedToGraphQL ( fields . contacts ) ;
193- // $FlowFixMe
187+ const embeddedType : any = embeddedToGraphQL ( fields . contacts ) ;
194188 const embeddedFields = embeddedType . _typeConfig . fields ( ) ;
195189 expect ( embeddedFields . email ) . toBeTruthy ( ) ;
196190 expect ( embeddedFields . locationId ) . toBeTruthy ( ) ;
@@ -212,7 +206,7 @@ describe('fieldConverter', () => {
212206 name : 'Test empty subDoc' ,
213207 } ) ;
214208 await user . save ( ) ;
215- const result = await graphql (
209+ const result : any = await graphql (
216210 schema ,
217211 `{
218212 user(_id: "${ user . _id } ") {
@@ -226,7 +220,7 @@ describe('fieldConverter', () => {
226220 }
227221 }`
228222 ) ;
229- // $FlowFixMe
223+
230224 expect ( result . data . user ) . toEqual ( {
231225 name : 'Test empty subDoc' ,
232226 subDoc : null ,
@@ -255,7 +249,7 @@ describe('fieldConverter', () => {
255249 subDoc : { field2 : { field21 : 'ok' } } ,
256250 } ) ;
257251 await user2 . save ( ) ;
258- const result2 = await graphql (
252+ const result2 : any = await graphql (
259253 schema ,
260254 `{
261255 user(_id: "${ user2 . _id } ") {
@@ -269,7 +263,7 @@ describe('fieldConverter', () => {
269263 }
270264 }`
271265 ) ;
272- // $FlowFixMe
266+
273267 expect ( result2 . data . user ) . toEqual ( {
274268 name : 'Test non empty subDoc' ,
275269 subDoc : {
@@ -281,8 +275,7 @@ describe('fieldConverter', () => {
281275 } ) ;
282276
283277 describe ( 'documentArrayToGraphQL()' , ( ) => {
284- const languagesType = documentArrayToGraphQL ( fields . languages ) ;
285- // $FlowFixMe
278+ const languagesType : any = documentArrayToGraphQL ( fields . languages ) ;
286279 const languagesFields = languagesType . ofType . _typeConfig . fields ( ) ;
287280
288281 it ( 'should produce GraphQLList' , ( ) => {
@@ -291,7 +284,6 @@ describe('fieldConverter', () => {
291284
292285 it ( 'should has Language type in ofType' , ( ) => {
293286 // see src/__mocks__/languageSchema.js where type name `Language` is defined
294- // $FlowFixMe
295287 expect ( languagesType . ofType . name ) . toBe ( 'Language' ) ;
296288 } ) ;
297289
@@ -341,10 +333,8 @@ describe('fieldConverter', () => {
341333 someDynamic
342334 }
343335 }` ;
344- const result = await graphql ( schema , query ) ;
345- // $FlowFixMe
336+ const result : any = await graphql ( schema , query ) ;
346337 expect ( result . data . user . name ) . toBe ( user . name ) ;
347- // $FlowFixMe
348338 expect ( result . data . user . someDynamic ) . toEqual ( user . someDynamic ) ;
349339 } ) ;
350340 } ) ;
0 commit comments