@@ -13,15 +13,15 @@ describe('Provides descriptive error messages for API abuse', () => {
13
13
14
14
it ( 'Loader creation requires a function' , ( ) => {
15
15
expect ( ( ) => {
16
- // $FlowExpectError
16
+ // $FlowExpectedError[incompatible-call]
17
17
new DataLoader ( ) ; // eslint-disable-line no-new
18
18
} ) . toThrow (
19
19
'DataLoader must be constructed with a function which accepts ' +
20
20
'Array<key> and returns Promise<Array<value>>, but got: undefined.'
21
21
) ;
22
22
23
23
expect ( ( ) => {
24
- // $FlowExpectError
24
+ // $FlowExpectedError[prop-missing]
25
25
new DataLoader ( { } ) ; // eslint-disable-line no-new
26
26
} ) . toThrow (
27
27
'DataLoader must be constructed with a function which accepts ' +
@@ -33,15 +33,15 @@ describe('Provides descriptive error messages for API abuse', () => {
33
33
const idLoader = new DataLoader < number , number > ( async keys => keys ) ;
34
34
35
35
expect ( ( ) => {
36
- // $FlowExpectError
36
+ // $FlowExpectedError[incompatible-call]
37
37
idLoader . load ( ) ;
38
38
} ) . toThrow (
39
39
'The loader.load() function must be called with a value, ' +
40
40
'but got: undefined.'
41
41
) ;
42
42
43
43
expect ( ( ) => {
44
- // $FlowExpectError
44
+ // $FlowExpectedError[incompatible-call]
45
45
idLoader . load ( null ) ;
46
46
} ) . toThrow (
47
47
'The loader.load() function must be called with a value, ' +
@@ -58,15 +58,16 @@ describe('Provides descriptive error messages for API abuse', () => {
58
58
const idLoader = new DataLoader < number , number > ( async keys => keys ) ;
59
59
60
60
expect ( ( ) => {
61
- // $FlowExpectError
61
+ // $FlowExpectedError[incompatible-call]
62
62
idLoader . loadMany ( ) ;
63
63
} ) . toThrow (
64
64
'The loader.loadMany() function must be called with Array<key> ' +
65
65
'but got: undefined.'
66
66
) ;
67
67
68
68
expect ( ( ) => {
69
- // $FlowExpectError
69
+ // $FlowExpectedError[incompatible-call]
70
+ // $FlowExpectedError[extra-arg]
70
71
idLoader . loadMany ( 1 , 2 , 3 ) ;
71
72
} ) . toThrow (
72
73
'The loader.loadMany() function must be called with Array<key> ' +
@@ -80,7 +81,7 @@ describe('Provides descriptive error messages for API abuse', () => {
80
81
} ) ;
81
82
82
83
it ( 'Batch function must return a Promise, not null' , async ( ) => {
83
- // $FlowExpectError
84
+ // $FlowExpectedError[incompatible-call]
84
85
const badLoader = new DataLoader < number , number > ( ( ) => null ) ;
85
86
86
87
let caughtError ;
@@ -99,7 +100,7 @@ describe('Provides descriptive error messages for API abuse', () => {
99
100
100
101
it ( 'Batch function must return a Promise, not a value' , async ( ) => {
101
102
// Note: this is returning the keys directly, rather than a promise to keys.
102
- // $FlowExpectError
103
+ // $FlowExpectedError[incompatible-call]
103
104
const badLoader = new DataLoader < number , number > ( keys => keys ) ;
104
105
105
106
let caughtError ;
@@ -118,7 +119,7 @@ describe('Provides descriptive error messages for API abuse', () => {
118
119
119
120
it ( 'Batch function must return a Promise of an Array, not null' , async ( ) => {
120
121
// Note: this resolves to undefined
121
- // $FlowExpectError
122
+ // $FlowExpectedError[incompatible-call]
122
123
const badLoader = new DataLoader < number , number > ( async ( ) => null ) ;
123
124
124
125
let caughtError ;
@@ -162,9 +163,9 @@ describe('Provides descriptive error messages for API abuse', () => {
162
163
}
163
164
164
165
expect ( ( ) => {
165
- // $FlowExpectError
166
166
const incompleteMap = new IncompleteMap ( ) ;
167
167
const options = { cacheMap : incompleteMap } ;
168
+ // $FlowExpectedError[incompatible-call]
168
169
new DataLoader ( async keys => keys , options ) ; // eslint-disable-line no-new
169
170
} ) . toThrow (
170
171
'Custom cacheMap missing methods: set, delete, clear'
@@ -173,7 +174,7 @@ describe('Provides descriptive error messages for API abuse', () => {
173
174
174
175
it ( 'Requires a number for maxBatchSize' , ( ) => {
175
176
expect ( ( ) =>
176
- // $FlowExpectError
177
+ // $FlowExpectedError[incompatible-call]
177
178
new DataLoader ( async keys => keys , { maxBatchSize : null } )
178
179
) . toThrow ( 'maxBatchSize must be a positive number: null' ) ;
179
180
} ) ;
@@ -186,14 +187,14 @@ describe('Provides descriptive error messages for API abuse', () => {
186
187
187
188
it ( 'Requires a function for cacheKeyFn' , ( ) => {
188
189
expect ( ( ) =>
189
- // $FlowExpectError
190
+ // $FlowExpectedError[incompatible-call]
190
191
new DataLoader ( async keys => keys , { cacheKeyFn : null } )
191
192
) . toThrow ( 'cacheKeyFn must be a function: null' ) ;
192
193
} ) ;
193
194
194
195
it ( 'Requires a function for batchScheduleFn' , ( ) => {
195
196
expect ( ( ) =>
196
- // $FlowExpectError
197
+ // $FlowExpectedError[incompatible-call]
197
198
new DataLoader ( async keys => keys , { batchScheduleFn : null } )
198
199
) . toThrow ( 'batchScheduleFn must be a function: null' ) ;
199
200
} ) ;
0 commit comments