From d697f28add6f760d61d8e74268930aadb5e96c28 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Thu, 8 Aug 2019 00:45:58 +0300 Subject: [PATCH] Add benchmark for validating invalid query Motivated by #2074 --- .../__tests__/validateInvalidGQL-benchmark.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/validation/__tests__/validateInvalidGQL-benchmark.js diff --git a/src/validation/__tests__/validateInvalidGQL-benchmark.js b/src/validation/__tests__/validateInvalidGQL-benchmark.js new file mode 100644 index 0000000000..13e9402d64 --- /dev/null +++ b/src/validation/__tests__/validateInvalidGQL-benchmark.js @@ -0,0 +1,29 @@ +// @flow strict + +import { parse } from '../../language/parser'; +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { validate } from '../validate'; + +import { bigSchemaSDL } from '../../__fixtures__'; + +const schema = buildSchema(bigSchemaSDL, { assumeValid: true }); +const queryAST = parse(` + { + unknownField + ... on unknownType { + anotherUnknownField + ...unknownFragment + } + } + + fragment TestFragment on anotherUnknownType { + yetAnotherUnknownField + } +`); + +export const name = 'Validate Invalid Query'; +export const count = 50; +export function measure() { + validate(schema, queryAST); +}