@@ -5,11 +5,13 @@ import { TypeWeightObject, Variables } from '../../src/@types/buildTypeWeights';
55/**
66 * Here is the schema that creates the following 'typeWeightsObject' used for the tests
77 *
8+ directive @listCost(cost: Int!) on FIELD_DEFINITION
9+
810 type Query {
911 hero(episode: Episode): Character
1012 heroUnion(episode: Episode): SearchResult
1113 reviews(episode: Episode!, first: Int): [Review]
12- search(text: String): [SearchResult]
14+ search(text: String): [SearchResult] @listCost (cost: 10)
1315 character(id: ID!): Character
1416 droid(id: ID!): Droid
1517 human(id: ID!): Human
@@ -136,7 +138,7 @@ describe('Test getQueryTypeComplexity function', () => {
136138 } ,
137139 search : {
138140 resolveTo : 'searchresult' ,
139- weight : 10 , // FIXME: Unbounded list result
141+ weight : 10 ,
140142 } ,
141143 character : {
142144 resolveTo : 'character' ,
@@ -797,20 +799,6 @@ describe('Test getQueryTypeComplexity function', () => {
797799 } ) ;
798800 } ) ;
799801
800- /**
801- * FIXME: handle lists of unknown size. change the expected result Once we figure out the implementation.
802- */
803- xtest ( 'with lists of unknown size' , ( ) => {
804- query = `
805- query {
806- search(text: 'hi') {
807- id
808- name
809- }
810- }` ;
811- expect ( getQueryTypeComplexity ( parse ( query ) , variables , typeWeights ) ) . toBe ( false ) ; // ?
812- } ) ;
813-
814802 test ( 'with lists determined by arguments and variables' , ( ) => {
815803 query = `query {reviews(episode: EMPIRE, first: 3) { stars, commentary } }` ;
816804 mockWeightFunction . mockReturnValueOnce ( 3 ) ;
0 commit comments