@@ -40,7 +40,7 @@ describe('Weight Function correctly parses Argument Nodes if', () => {
4040 xtest ( 'and a value is not provided with the query' , ( ) => {
4141 const query = `query { reviews(episode: NEWHOPE) { stars, episode } }` ;
4242 const queryAST : DocumentNode = parse ( query ) ;
43- expect ( getQueryTypeComplexity ( queryAST , { } , typeWeights ) ) . toBe ( 5 ) ;
43+ expect ( getQueryTypeComplexity ( queryAST , { } , typeWeights ) ) . toBe ( 6 ) ;
4444 } ) ;
4545
4646 test ( 'and a scalar value is provided with the query' , ( ) => {
@@ -52,8 +52,8 @@ describe('Weight Function correctly parses Argument Nodes if', () => {
5252 xtest ( 'and the argument is passed in as a variable' , ( ) => {
5353 const query = `query variableQuery ($items: Int){ reviews(episode: NEWHOPE, first: $items) { stars, episode } }` ;
5454 const queryAST : DocumentNode = parse ( query ) ;
55- expect ( getQueryTypeComplexity ( queryAST , { items : 7 , first : 4 } , typeWeights ) ) . toBe ( 8 ) ;
56- expect ( getQueryTypeComplexity ( queryAST , { first : 4 , items : 7 } , typeWeights ) ) . toBe ( 8 ) ;
55+ expect ( getQueryTypeComplexity ( queryAST , { items : 7 , first : 4 } , typeWeights ) ) . toBe ( 9 ) ;
56+ expect ( getQueryTypeComplexity ( queryAST , { first : 4 , items : 7 } , typeWeights ) ) . toBe ( 9 ) ;
5757 } ) ;
5858 } ) ;
5959
@@ -74,7 +74,7 @@ describe('Weight Function correctly parses Argument Nodes if', () => {
7474 xtest ( 'and the argument is passed in as a variable' , ( ) => {
7575 const query = `query variableQuery ($items: Int){ heroes(episode: NEWHOPE, first: $items) { stars, episode } }` ;
7676 const queryAST : DocumentNode = parse ( query ) ;
77- expect ( getQueryTypeComplexity ( queryAST , { items : 7 } , typeWeights ) ) . toBe ( 8 ) ;
77+ expect ( getQueryTypeComplexity ( queryAST , { items : 7 } , typeWeights ) ) . toBe ( 9 ) ;
7878 } ) ;
7979 } ) ;
8080
@@ -84,7 +84,13 @@ describe('Weight Function correctly parses Argument Nodes if', () => {
8484 } ) ;
8585 const query = `query { heroes(episode: NEWHOPE, first: 3) { stars, episode } }` ;
8686 const queryAST : DocumentNode = parse ( query ) ;
87- expect ( getQueryTypeComplexity ( queryAST , { } , customTypeWeights ) ) . toBe ( 10 ) ;
87+ expect ( getQueryTypeComplexity ( queryAST , { } , customTypeWeights ) ) . toBe ( 5 ) ;
88+ } ) ;
89+
90+ test ( 'variable names matching limiting keywords do not interfere with scalar argument values' , ( ) => {
91+ const query = `query variableQuery ($items: Int){ heroes(episode: NEWHOPE, first: 3) { stars, episode } }` ;
92+ const queryAST : DocumentNode = parse ( query ) ;
93+ expect ( getQueryTypeComplexity ( queryAST , { first : 7 } , typeWeights ) ) . toBe ( 5 ) ;
8894 } ) ;
8995
9096 xtest ( 'an invalid arg type is provided' , ( ) => {
0 commit comments