graphql-cost-analysis
                                
                                
                                
                                    graphql-cost-analysis copied to clipboard
                            
                            
                            
                        Multiple query/mutation and onComplete behavior
I don't know if it is a bug or not
For this test case
test('should consider default cost with operationName', done => {
  const ast = parse(
    `
    query operationA {
      defaultCost
    }
    query operationB {
      defaultCost
    }
  `)
  const context = new ValidationContext(schema, ast, typeInfo)
  const visitor = new CostAnalysis(context, {
    maximumCost: 100,
    defaultCost: 12,
    onComplete: cost => {
      console.log('cost', cost)
      done()
    }
  })
  visit(ast, visitWithTypeInfo(typeInfo, visitor))
})
I have 2 queries, onComplete will be called 2 times
First time, cost is 12, second time 24. :thinking:
After that, i use operationName, like "operationName":"operationB"
Should operationA be analysed and count in the total cost ?