@@ -13,15 +13,15 @@ describe('Provides descriptive error messages for API abuse', () => {
1313
1414 it ( 'Loader creation requires a function' , ( ) => {
1515 expect ( ( ) => {
16- // $FlowExpectError
16+ // $FlowExpectedError[incompatible-call]
1717 new DataLoader ( ) ; // eslint-disable-line no-new
1818 } ) . toThrow (
1919 'DataLoader must be constructed with a function which accepts ' +
2020 'Array<key> and returns Promise<Array<value>>, but got: undefined.'
2121 ) ;
2222
2323 expect ( ( ) => {
24- // $FlowExpectError
24+ // $FlowExpectedError[prop-missing]
2525 new DataLoader ( { } ) ; // eslint-disable-line no-new
2626 } ) . toThrow (
2727 'DataLoader must be constructed with a function which accepts ' +
@@ -33,15 +33,15 @@ describe('Provides descriptive error messages for API abuse', () => {
3333 const idLoader = new DataLoader < number , number > ( async keys => keys ) ;
3434
3535 expect ( ( ) => {
36- // $FlowExpectError
36+ // $FlowExpectedError[incompatible-call]
3737 idLoader . load ( ) ;
3838 } ) . toThrow (
3939 'The loader.load() function must be called with a value, ' +
4040 'but got: undefined.'
4141 ) ;
4242
4343 expect ( ( ) => {
44- // $FlowExpectError
44+ // $FlowExpectedError[incompatible-call]
4545 idLoader . load ( null ) ;
4646 } ) . toThrow (
4747 'The loader.load() function must be called with a value, ' +
@@ -58,15 +58,16 @@ describe('Provides descriptive error messages for API abuse', () => {
5858 const idLoader = new DataLoader < number , number > ( async keys => keys ) ;
5959
6060 expect ( ( ) => {
61- // $FlowExpectError
61+ // $FlowExpectedError[incompatible-call]
6262 idLoader . loadMany ( ) ;
6363 } ) . toThrow (
6464 'The loader.loadMany() function must be called with Array<key> ' +
6565 'but got: undefined.'
6666 ) ;
6767
6868 expect ( ( ) => {
69- // $FlowExpectError
69+ // $FlowExpectedError[incompatible-call]
70+ // $FlowExpectedError[extra-arg]
7071 idLoader . loadMany ( 1 , 2 , 3 ) ;
7172 } ) . toThrow (
7273 'The loader.loadMany() function must be called with Array<key> ' +
@@ -80,7 +81,7 @@ describe('Provides descriptive error messages for API abuse', () => {
8081 } ) ;
8182
8283 it ( 'Batch function must return a Promise, not null' , async ( ) => {
83- // $FlowExpectError
84+ // $FlowExpectedError[incompatible-call]
8485 const badLoader = new DataLoader < number , number > ( ( ) => null ) ;
8586
8687 let caughtError ;
@@ -99,7 +100,7 @@ describe('Provides descriptive error messages for API abuse', () => {
99100
100101 it ( 'Batch function must return a Promise, not a value' , async ( ) => {
101102 // Note: this is returning the keys directly, rather than a promise to keys.
102- // $FlowExpectError
103+ // $FlowExpectedError[incompatible-call]
103104 const badLoader = new DataLoader < number , number > ( keys => keys ) ;
104105
105106 let caughtError ;
@@ -118,7 +119,7 @@ describe('Provides descriptive error messages for API abuse', () => {
118119
119120 it ( 'Batch function must return a Promise of an Array, not null' , async ( ) => {
120121 // Note: this resolves to undefined
121- // $FlowExpectError
122+ // $FlowExpectedError[incompatible-call]
122123 const badLoader = new DataLoader < number , number > ( async ( ) => null ) ;
123124
124125 let caughtError ;
@@ -162,9 +163,9 @@ describe('Provides descriptive error messages for API abuse', () => {
162163 }
163164
164165 expect ( ( ) => {
165- // $FlowExpectError
166166 const incompleteMap = new IncompleteMap ( ) ;
167167 const options = { cacheMap : incompleteMap } ;
168+ // $FlowExpectedError[incompatible-call]
168169 new DataLoader ( async keys => keys , options ) ; // eslint-disable-line no-new
169170 } ) . toThrow (
170171 'Custom cacheMap missing methods: set, delete, clear'
@@ -173,7 +174,7 @@ describe('Provides descriptive error messages for API abuse', () => {
173174
174175 it ( 'Requires a number for maxBatchSize' , ( ) => {
175176 expect ( ( ) =>
176- // $FlowExpectError
177+ // $FlowExpectedError[incompatible-call]
177178 new DataLoader ( async keys => keys , { maxBatchSize : null } )
178179 ) . toThrow ( 'maxBatchSize must be a positive number: null' ) ;
179180 } ) ;
@@ -186,14 +187,14 @@ describe('Provides descriptive error messages for API abuse', () => {
186187
187188 it ( 'Requires a function for cacheKeyFn' , ( ) => {
188189 expect ( ( ) =>
189- // $FlowExpectError
190+ // $FlowExpectedError[incompatible-call]
190191 new DataLoader ( async keys => keys , { cacheKeyFn : null } )
191192 ) . toThrow ( 'cacheKeyFn must be a function: null' ) ;
192193 } ) ;
193194
194195 it ( 'Requires a function for batchScheduleFn' , ( ) => {
195196 expect ( ( ) =>
196- // $FlowExpectError
197+ // $FlowExpectedError[incompatible-call]
197198 new DataLoader ( async keys => keys , { batchScheduleFn : null } )
198199 ) . toThrow ( 'batchScheduleFn must be a function: null' ) ;
199200 } ) ;
0 commit comments