@@ -17,7 +17,7 @@ import ElasticApiParser from '../ElasticApiParser';
1717const apiPartialPath = path . resolve ( __dirname , '../__mocks__/apiPartial.js' ) ;
1818
1919describe ( 'ElasticApiParser' , ( ) => {
20- let parser ;
20+ let parser : ElasticApiParser ;
2121
2222 beforeEach ( ( ) => {
2323 parser = new ElasticApiParser ( {
@@ -44,6 +44,7 @@ describe('ElasticApiParser', () => {
4444 describe ( 'findApiVersionFile()' , ( ) => {
4545 it ( 'should find proper version in elasticsearch 12.x' , ( ) => {
4646 const { loadApiListFile } = ElasticApiParser ;
47+
4748 // $FlowFixMe
4849 ElasticApiParser . loadApiListFile = ( ) =>
4950 `
@@ -60,19 +61,15 @@ describe('ElasticApiParser', () => {
6061 ` ;
6162
6263 expect ( ElasticApiParser . findApiVersionFile ( '5.0' ) ) . toMatch (
63- // $FlowFixMe
6464 'elasticsearch/src/lib/apis/5_0.js'
6565 ) ;
6666 expect ( ElasticApiParser . findApiVersionFile ( '2.4' ) ) . toMatch (
67- // $FlowFixMe
6867 'elasticsearch/src/lib/apis/2_4.js'
6968 ) ;
7069 expect ( ElasticApiParser . findApiVersionFile ( '1.7' ) ) . toMatch (
71- // $FlowFixMe
7270 'elasticsearch/src/lib/apis/1_7.js'
7371 ) ;
7472 expect ( ElasticApiParser . findApiVersionFile ( '_default' ) ) . toMatch (
75- // $FlowFixMe
7673 'elasticsearch/src/lib/apis/5_0.js'
7774 ) ;
7875
@@ -82,6 +79,7 @@ describe('ElasticApiParser', () => {
8279
8380 it ( 'should find proper version in elasticsearch 13.x' , ( ) => {
8481 const { loadApiListFile } = ElasticApiParser ;
82+
8583 // $FlowFixMe
8684 ElasticApiParser . loadApiListFile = ( ) =>
8785 `
@@ -100,19 +98,15 @@ describe('ElasticApiParser', () => {
10098 ` ;
10199
102100 expect ( ElasticApiParser . findApiVersionFile ( '5.0' ) ) . toMatch (
103- // $FlowFixMe
104101 'elasticsearch/src/lib/apis/5_0.js'
105102 ) ;
106103 expect ( ElasticApiParser . findApiVersionFile ( '2.4' ) ) . toMatch (
107- // $FlowFixMe
108104 'elasticsearch/src/lib/apis/2_4.js'
109105 ) ;
110106 expect ( ElasticApiParser . findApiVersionFile ( '1.7' ) ) . toMatch (
111- // $FlowFixMe
112107 'elasticsearch/src/lib/apis/1_7.js'
113108 ) ;
114109 expect ( ElasticApiParser . findApiVersionFile ( '_default' ) ) . toMatch (
115- // $FlowFixMe
116110 'elasticsearch/src/lib/apis/5_3.js'
117111 ) ;
118112
@@ -267,8 +261,7 @@ describe('ElasticApiParser', () => {
267261 ElasticApiParser . parseSource ( '' ) ;
268262 } ) . toThrowError ( 'Empty source' ) ;
269263 expect ( ( ) => {
270- // $FlowFixMe
271- ElasticApiParser . parseSource ( 123 ) ;
264+ ElasticApiParser . parseSource ( ( 123 : any ) ) ;
272265 } ) . toThrowError ( 'should be non-empty string' ) ;
273266 } ) ;
274267
@@ -482,23 +475,23 @@ describe('ElasticApiParser', () => {
482475 } ) ;
483476
484477 it ( 'should combine nested field in GraphQLObjectType' , ( ) => {
485- const reFields = parser . reassembleNestedFields ( {
478+ const reFields : any = parser . reassembleNestedFields ( {
486479 'cat.field1' : { type : GraphQLString } ,
487480 'cat.field2' : { type : GraphQLString } ,
488481 'index.exists' : { type : GraphQLBoolean } ,
489482 } ) ;
490483 expect ( Object . keys ( reFields ) . length ) . toEqual ( 2 ) ;
491484 expect ( reFields . cat ) . toBeDefined ( ) ;
492485 expect ( reFields . cat . type ) . toBeInstanceOf ( GraphQLObjectType ) ;
493- // $FlowFixMe
486+
494487 const tc = TypeComposer . create ( reFields . cat . type ) ;
495488 expect ( tc . getFieldNames ( ) ) . toEqual ( [ 'field1' , 'field2' ] ) ;
496489 expect ( tc . getFieldType ( 'field1' ) ) . toEqual ( GraphQLString ) ;
497490 expect ( tc . getFieldType ( 'field2' ) ) . toEqual ( GraphQLString ) ;
498491
499492 expect ( reFields . index ) . toBeDefined ( ) ;
500493 expect ( reFields . index . type ) . toBeInstanceOf ( GraphQLObjectType ) ;
501- // $FlowFixMe
494+
502495 const tc2 = TypeComposer . create ( reFields . index . type ) ;
503496 expect ( tc2 . getFieldNames ( ) ) . toEqual ( [ 'exists' ] ) ;
504497 expect ( tc2 . getFieldType ( 'exists' ) ) . toEqual ( GraphQLBoolean ) ;
@@ -508,8 +501,7 @@ describe('ElasticApiParser', () => {
508501 describe ( 'generateFieldConfig()' , ( ) => {
509502 it ( 'should throw error if provided empty method name' , ( ) => {
510503 expect ( ( ) => {
511- // $FlowFixMe
512- parser . generateFieldConfig ( ) ;
504+ parser . generateFieldConfig ( ( undefined : any ) ) ;
513505 } ) . toThrowError ( 'provide Elastic search method' ) ;
514506 } ) ;
515507
0 commit comments