5
5
import {
6
6
parse ,
7
7
TypeInfo ,
8
- ValidationContext ,
9
8
visit ,
10
9
visitWithTypeInfo ,
11
10
} from 'graphql' ;
@@ -18,8 +17,9 @@ import ComplexityVisitor, {getComplexity} from '../QueryComplexity';
18
17
import {
19
18
simpleEstimator ,
20
19
directiveEstimator ,
21
- fieldConfigEstimator ,
20
+ fieldExtensionsEstimator ,
22
21
} from '../index' ;
22
+ import { CompatibleValidationContext } from './fixtures/CompatibleValidationContext' ;
23
23
24
24
describe ( 'QueryComplexity analysis' , ( ) => {
25
25
const typeInfo = new TypeInfo ( schema ) ;
@@ -135,7 +135,7 @@ describe('QueryComplexity analysis', () => {
135
135
136
136
const complexity = getComplexity ( {
137
137
estimators : [
138
- fieldConfigEstimator ( ) ,
138
+ fieldExtensionsEstimator ( ) ,
139
139
simpleEstimator ( { defaultComplexity : 1 } )
140
140
] ,
141
141
schema,
@@ -154,7 +154,7 @@ describe('QueryComplexity analysis', () => {
154
154
}
155
155
` ) ;
156
156
157
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
157
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
158
158
const visitor = new ComplexityVisitor ( context , {
159
159
maximumComplexity : 100 ,
160
160
estimators : [
@@ -173,11 +173,11 @@ describe('QueryComplexity analysis', () => {
173
173
}
174
174
` ) ;
175
175
176
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
176
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
177
177
const visitor = new ComplexityVisitor ( context , {
178
178
maximumComplexity : 100 ,
179
179
estimators : [
180
- fieldConfigEstimator ( ) ,
180
+ fieldExtensionsEstimator ( ) ,
181
181
simpleEstimator ( {
182
182
defaultComplexity : 1
183
183
} )
@@ -203,11 +203,11 @@ describe('QueryComplexity analysis', () => {
203
203
}
204
204
` ) ;
205
205
206
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
206
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
207
207
const visitor = new ComplexityVisitor ( context , {
208
208
maximumComplexity : 100 ,
209
209
estimators : [
210
- fieldConfigEstimator ( ) ,
210
+ fieldExtensionsEstimator ( ) ,
211
211
simpleEstimator ( {
212
212
defaultComplexity : 1
213
213
} )
@@ -230,11 +230,11 @@ describe('QueryComplexity analysis', () => {
230
230
}
231
231
` ) ;
232
232
233
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
233
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
234
234
const visitor = new ComplexityVisitor ( context , {
235
235
maximumComplexity : 100 ,
236
236
estimators : [
237
- fieldConfigEstimator ( ) ,
237
+ fieldExtensionsEstimator ( ) ,
238
238
simpleEstimator ( {
239
239
defaultComplexity : 1
240
240
} )
@@ -257,11 +257,11 @@ describe('QueryComplexity analysis', () => {
257
257
}
258
258
` ) ;
259
259
260
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
260
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
261
261
const visitor = new ComplexityVisitor ( context , {
262
262
maximumComplexity : 100 ,
263
263
estimators : [
264
- fieldConfigEstimator ( ) ,
264
+ fieldExtensionsEstimator ( ) ,
265
265
simpleEstimator ( {
266
266
defaultComplexity : 1
267
267
} )
@@ -284,11 +284,11 @@ describe('QueryComplexity analysis', () => {
284
284
}
285
285
` ) ;
286
286
287
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
287
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
288
288
const visitor = new ComplexityVisitor ( context , {
289
289
maximumComplexity : 100 ,
290
290
estimators : [
291
- fieldConfigEstimator ( ) ,
291
+ fieldExtensionsEstimator ( ) ,
292
292
simpleEstimator ( {
293
293
defaultComplexity : 1
294
294
} )
@@ -310,11 +310,11 @@ describe('QueryComplexity analysis', () => {
310
310
}
311
311
` ) ;
312
312
313
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
313
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
314
314
const visitor = new ComplexityVisitor ( context , {
315
315
maximumComplexity : 100 ,
316
316
estimators : [
317
- fieldConfigEstimator ( ) ,
317
+ fieldExtensionsEstimator ( ) ,
318
318
simpleEstimator ( {
319
319
defaultComplexity : 1
320
320
} )
@@ -332,11 +332,11 @@ describe('QueryComplexity analysis', () => {
332
332
}
333
333
` ) ;
334
334
335
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
335
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
336
336
const visitor = new ComplexityVisitor ( context , {
337
337
maximumComplexity : 100 ,
338
338
estimators : [
339
- fieldConfigEstimator ( ) ,
339
+ fieldExtensionsEstimator ( ) ,
340
340
simpleEstimator ( {
341
341
defaultComplexity : 1
342
342
} )
@@ -353,11 +353,11 @@ describe('QueryComplexity analysis', () => {
353
353
requiredArgs
354
354
}
355
355
` ) ;
356
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
356
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
357
357
const visitor = new ComplexityVisitor ( context , {
358
358
maximumComplexity : 100 ,
359
359
estimators : [
360
- fieldConfigEstimator ( ) ,
360
+ fieldExtensionsEstimator ( ) ,
361
361
simpleEstimator ( {
362
362
defaultComplexity : 1
363
363
} )
@@ -374,7 +374,7 @@ describe('QueryComplexity analysis', () => {
374
374
scalar
375
375
}
376
376
` ) ;
377
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
377
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
378
378
const visitor = new ComplexityVisitor ( context , {
379
379
maximumComplexity : 100 ,
380
380
estimators : [ ]
@@ -393,11 +393,11 @@ describe('QueryComplexity analysis', () => {
393
393
scalar
394
394
}
395
395
` ) ;
396
- const context = new ValidationContext ( schema , ast , typeInfo ) ;
396
+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
397
397
const visitor = new ComplexityVisitor ( context , {
398
398
maximumComplexity : 100 ,
399
399
estimators : [
400
- fieldConfigEstimator ( )
400
+ fieldExtensionsEstimator ( )
401
401
]
402
402
} ) ;
403
403
visit ( ast , visitWithTypeInfo ( typeInfo , visitor ) ) ;
@@ -463,7 +463,7 @@ describe('QueryComplexity analysis', () => {
463
463
464
464
const complexity1 = getComplexity ( {
465
465
estimators : [
466
- fieldConfigEstimator ( ) ,
466
+ fieldExtensionsEstimator ( ) ,
467
467
simpleEstimator ( { defaultComplexity : 1 } )
468
468
] ,
469
469
schema,
@@ -473,7 +473,7 @@ describe('QueryComplexity analysis', () => {
473
473
474
474
const complexity2 = getComplexity ( {
475
475
estimators : [
476
- fieldConfigEstimator ( ) ,
476
+ fieldExtensionsEstimator ( ) ,
477
477
simpleEstimator ( { defaultComplexity : 1 } )
478
478
] ,
479
479
schema,
0 commit comments