55import {
66 parse ,
77 TypeInfo ,
8- ValidationContext ,
98 visit ,
109 visitWithTypeInfo ,
1110} from 'graphql' ;
@@ -18,8 +17,9 @@ import ComplexityVisitor, {getComplexity} from '../QueryComplexity';
1817import {
1918 simpleEstimator ,
2019 directiveEstimator ,
21- fieldConfigEstimator ,
20+ fieldExtensionsEstimator ,
2221} from '../index' ;
22+ import { CompatibleValidationContext } from './fixtures/CompatibleValidationContext' ;
2323
2424describe ( 'QueryComplexity analysis' , ( ) => {
2525 const typeInfo = new TypeInfo ( schema ) ;
@@ -135,7 +135,7 @@ describe('QueryComplexity analysis', () => {
135135
136136 const complexity = getComplexity ( {
137137 estimators : [
138- fieldConfigEstimator ( ) ,
138+ fieldExtensionsEstimator ( ) ,
139139 simpleEstimator ( { defaultComplexity : 1 } )
140140 ] ,
141141 schema,
@@ -154,7 +154,7 @@ describe('QueryComplexity analysis', () => {
154154 }
155155 ` ) ;
156156
157- const context = new ValidationContext ( schema , ast , typeInfo ) ;
157+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
158158 const visitor = new ComplexityVisitor ( context , {
159159 maximumComplexity : 100 ,
160160 estimators : [
@@ -173,11 +173,11 @@ describe('QueryComplexity analysis', () => {
173173 }
174174 ` ) ;
175175
176- const context = new ValidationContext ( schema , ast , typeInfo ) ;
176+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
177177 const visitor = new ComplexityVisitor ( context , {
178178 maximumComplexity : 100 ,
179179 estimators : [
180- fieldConfigEstimator ( ) ,
180+ fieldExtensionsEstimator ( ) ,
181181 simpleEstimator ( {
182182 defaultComplexity : 1
183183 } )
@@ -203,11 +203,11 @@ describe('QueryComplexity analysis', () => {
203203 }
204204 ` ) ;
205205
206- const context = new ValidationContext ( schema , ast , typeInfo ) ;
206+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
207207 const visitor = new ComplexityVisitor ( context , {
208208 maximumComplexity : 100 ,
209209 estimators : [
210- fieldConfigEstimator ( ) ,
210+ fieldExtensionsEstimator ( ) ,
211211 simpleEstimator ( {
212212 defaultComplexity : 1
213213 } )
@@ -230,11 +230,11 @@ describe('QueryComplexity analysis', () => {
230230 }
231231 ` ) ;
232232
233- const context = new ValidationContext ( schema , ast , typeInfo ) ;
233+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
234234 const visitor = new ComplexityVisitor ( context , {
235235 maximumComplexity : 100 ,
236236 estimators : [
237- fieldConfigEstimator ( ) ,
237+ fieldExtensionsEstimator ( ) ,
238238 simpleEstimator ( {
239239 defaultComplexity : 1
240240 } )
@@ -257,11 +257,11 @@ describe('QueryComplexity analysis', () => {
257257 }
258258 ` ) ;
259259
260- const context = new ValidationContext ( schema , ast , typeInfo ) ;
260+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
261261 const visitor = new ComplexityVisitor ( context , {
262262 maximumComplexity : 100 ,
263263 estimators : [
264- fieldConfigEstimator ( ) ,
264+ fieldExtensionsEstimator ( ) ,
265265 simpleEstimator ( {
266266 defaultComplexity : 1
267267 } )
@@ -284,11 +284,11 @@ describe('QueryComplexity analysis', () => {
284284 }
285285 ` ) ;
286286
287- const context = new ValidationContext ( schema , ast , typeInfo ) ;
287+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
288288 const visitor = new ComplexityVisitor ( context , {
289289 maximumComplexity : 100 ,
290290 estimators : [
291- fieldConfigEstimator ( ) ,
291+ fieldExtensionsEstimator ( ) ,
292292 simpleEstimator ( {
293293 defaultComplexity : 1
294294 } )
@@ -310,11 +310,11 @@ describe('QueryComplexity analysis', () => {
310310 }
311311 ` ) ;
312312
313- const context = new ValidationContext ( schema , ast , typeInfo ) ;
313+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
314314 const visitor = new ComplexityVisitor ( context , {
315315 maximumComplexity : 100 ,
316316 estimators : [
317- fieldConfigEstimator ( ) ,
317+ fieldExtensionsEstimator ( ) ,
318318 simpleEstimator ( {
319319 defaultComplexity : 1
320320 } )
@@ -332,11 +332,11 @@ describe('QueryComplexity analysis', () => {
332332 }
333333 ` ) ;
334334
335- const context = new ValidationContext ( schema , ast , typeInfo ) ;
335+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
336336 const visitor = new ComplexityVisitor ( context , {
337337 maximumComplexity : 100 ,
338338 estimators : [
339- fieldConfigEstimator ( ) ,
339+ fieldExtensionsEstimator ( ) ,
340340 simpleEstimator ( {
341341 defaultComplexity : 1
342342 } )
@@ -353,11 +353,11 @@ describe('QueryComplexity analysis', () => {
353353 requiredArgs
354354 }
355355 ` ) ;
356- const context = new ValidationContext ( schema , ast , typeInfo ) ;
356+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
357357 const visitor = new ComplexityVisitor ( context , {
358358 maximumComplexity : 100 ,
359359 estimators : [
360- fieldConfigEstimator ( ) ,
360+ fieldExtensionsEstimator ( ) ,
361361 simpleEstimator ( {
362362 defaultComplexity : 1
363363 } )
@@ -374,7 +374,7 @@ describe('QueryComplexity analysis', () => {
374374 scalar
375375 }
376376 ` ) ;
377- const context = new ValidationContext ( schema , ast , typeInfo ) ;
377+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
378378 const visitor = new ComplexityVisitor ( context , {
379379 maximumComplexity : 100 ,
380380 estimators : [ ]
@@ -393,11 +393,11 @@ describe('QueryComplexity analysis', () => {
393393 scalar
394394 }
395395 ` ) ;
396- const context = new ValidationContext ( schema , ast , typeInfo ) ;
396+ const context = new CompatibleValidationContext ( schema , ast , typeInfo ) ;
397397 const visitor = new ComplexityVisitor ( context , {
398398 maximumComplexity : 100 ,
399399 estimators : [
400- fieldConfigEstimator ( )
400+ fieldExtensionsEstimator ( )
401401 ]
402402 } ) ;
403403 visit ( ast , visitWithTypeInfo ( typeInfo , visitor ) ) ;
@@ -463,7 +463,7 @@ describe('QueryComplexity analysis', () => {
463463
464464 const complexity1 = getComplexity ( {
465465 estimators : [
466- fieldConfigEstimator ( ) ,
466+ fieldExtensionsEstimator ( ) ,
467467 simpleEstimator ( { defaultComplexity : 1 } )
468468 ] ,
469469 schema,
@@ -473,7 +473,7 @@ describe('QueryComplexity analysis', () => {
473473
474474 const complexity2 = getComplexity ( {
475475 estimators : [
476- fieldConfigEstimator ( ) ,
476+ fieldExtensionsEstimator ( ) ,
477477 simpleEstimator ( { defaultComplexity : 1 } )
478478 ] ,
479479 schema,
0 commit comments