@@ -20,17 +20,17 @@ describe('connectionResolver', () => {
2020 } ) ;
2121
2222 it ( 'should throw error if first arg is not TypeComposer' , ( ) => {
23- // $FlowFixMe
24- expect ( ( ) => prepareConnectionResolver ( 123 ) ) . toThrowError (
25- 'should be instance of TypeComposer'
26- ) ;
23+ expect ( ( ) => {
24+ const wrongArgs : any = [ 123 ] ;
25+ prepareConnectionResolver ( ... wrongArgs ) ;
26+ } ) . toThrowError ( 'should be instance of TypeComposer' ) ;
2727 } ) ;
2828
2929 it ( 'should throw error if opts.countResolverName are empty' , ( ) => {
30- // $FlowFixMe
31- expect ( ( ) => prepareConnectionResolver ( userTypeComposer , { } ) ) . toThrowError (
32- 'should have option `opts.countResolverName`'
33- ) ;
30+ expect ( ( ) => {
31+ const wrongArgs : any = [ userTypeComposer , { } ] ;
32+ prepareConnectionResolver ( ... wrongArgs ) ;
33+ } ) . toThrowError ( 'should have option `opts.countResolverName`' ) ;
3434 } ) ;
3535
3636 it ( 'should throw error if resolver opts.countResolverName does not exists' , ( ) => {
@@ -44,22 +44,24 @@ describe('connectionResolver', () => {
4444 } ) ;
4545
4646 it ( 'should throw error if opts.findResolverName are empty' , ( ) => {
47- expect ( ( ) =>
48- // $FlowFixMe
49- prepareConnectionResolver ( userTypeComposer , {
50- countResolverName : 'count' ,
51- } )
52- ) . toThrowError ( 'should have option `opts.findResolverName`' ) ;
47+ expect ( ( ) => {
48+ const wrongArgs : any = [ userTypeComposer , { countResolverName : 'count' } ] ;
49+ prepareConnectionResolver ( ...wrongArgs ) ;
50+ } ) . toThrowError ( 'should have option `opts.findResolverName`' ) ;
5351 } ) ;
5452
5553 it ( 'should throw error if resolver opts.countResolverName does not exists' , ( ) => {
56- expect ( ( ) =>
57- prepareConnectionResolver ( userTypeComposer , {
58- countResolverName : 'count' ,
59- findResolverName : 'findManyDoesNotExists' ,
60- sort : sortOptions ,
61- } )
62- ) . toThrowError ( "does not have resolver with name 'findManyDoesNotExists'" ) ;
54+ expect ( ( ) => {
55+ const wrongArgs : any = [
56+ userTypeComposer ,
57+ {
58+ countResolverName : 'count' ,
59+ findResolverName : 'findManyDoesNotExists' ,
60+ sort : sortOptions ,
61+ } ,
62+ ] ;
63+ prepareConnectionResolver ( ...wrongArgs ) ;
64+ } ) . toThrowError ( "does not have resolver with name 'findManyDoesNotExists'" ) ;
6365 } ) ;
6466 } ) ;
6567
@@ -73,34 +75,28 @@ describe('connectionResolver', () => {
7375 } ) ;
7476
7577 it ( 'should have type to be ConnectionType' , ( ) => {
76- // $FlowFixMe
77- expect ( connectionResolver . type . name ) . toBe ( 'UserConnection' ) ;
78+ expect ( ( connectionResolver . type : any ) . name ) . toBe ( 'UserConnection' ) ;
7879 } ) ;
7980 } ) ;
8081
8182 describe ( 'resolver args' , ( ) => {
8283 it ( 'should have `first` arg' , ( ) => {
83- // $FlowFixMe
8484 expect ( connectionResolver . getArg ( 'first' ) . type ) . toBe ( GraphQLInt ) ;
8585 } ) ;
8686
8787 it ( 'should have `last` arg' , ( ) => {
88- // $FlowFixMe
8988 expect ( connectionResolver . getArg ( 'last' ) . type ) . toBe ( GraphQLInt ) ;
9089 } ) ;
9190
9291 it ( 'should have `after` arg' , ( ) => {
93- // $FlowFixMe
9492 expect ( connectionResolver . getArg ( 'after' ) . type ) . toBe ( GraphQLString ) ;
9593 } ) ;
9694
9795 it ( 'should have `before` arg' , ( ) => {
98- // $FlowFixMe
9996 expect ( connectionResolver . getArg ( 'before' ) . type ) . toBe ( GraphQLString ) ;
10097 } ) ;
10198
10299 it ( 'should have `sort` arg' , ( ) => {
103- // $FlowFixMe
104100 expect ( connectionResolver . getArg ( 'sort' ) . type . name ) . toBe ( 'SortConnectionUserEnum' ) ;
105101 } ) ;
106102 } ) ;
@@ -276,11 +272,10 @@ describe('connectionResolver', () => {
276272 } ;
277273
278274 it ( 'should setup in resolveParams.rawQuery' , ( ) => {
279- const rp = {
275+ const rp : any = {
280276 args : { filter : { id : 123 } } ,
281277 } ;
282278 prepareRawQuery ( rp , sortConfig ) ;
283- // $FlowFixMe
284279 expect ( rp . rawQuery ) . toEqual ( { } ) ;
285280 } ) ;
286281
@@ -304,26 +299,24 @@ describe('connectionResolver', () => {
304299 } ) ;
305300
306301 it ( 'should call afterCursorQuery if provided args.after' , ( ) => {
307- const rp = {
302+ const rp : any = {
308303 args : {
309304 after : dataToCursor ( { id : 123 } ) ,
310305 sort : sortConfig ,
311306 } ,
312307 } ;
313308 prepareRawQuery ( rp , sortConfig ) ;
314- // $FlowFixMe
315309 expect ( rp . rawQuery ) . toEqual ( { after : { id : 123 } } ) ;
316310 } ) ;
317311
318312 it ( 'should call beforeCursorQuery if provided args.before' , ( ) => {
319- const rp = {
313+ const rp : any = {
320314 args : {
321315 before : dataToCursor ( { id : 234 } ) ,
322316 sort : sortConfig ,
323317 } ,
324318 } ;
325319 prepareRawQuery ( rp , sortConfig ) ;
326- // $FlowFixMe
327320 expect ( rp . rawQuery ) . toEqual ( { before : { id : 234 } } ) ;
328321 } ) ;
329322
0 commit comments