From 7937b3bee4164e26f902cbea5aff12d6ad48af5b Mon Sep 17 00:00:00 2001 From: Hoang Vo Date: Sat, 30 Jan 2021 15:21:59 +0700 Subject: [PATCH] use toMatchObject to expose difference --- src/__tests__/subscription.test.ts | 4 ++-- src/execution.ts | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/__tests__/subscription.test.ts b/src/__tests__/subscription.test.ts index 9f935c6..6d44ffe 100644 --- a/src/__tests__/subscription.test.ts +++ b/src/__tests__/subscription.test.ts @@ -1,5 +1,5 @@ /** - * Based on https://github.com/graphql/graphql-js/blob/master/src/subscription/subscribe.js + * Based on https://github.com/graphql/graphql-js/blob/main/src/subscription/__tests__/subscribe-test.js * This test suite makes an addition denoted by "*" comments: * graphql-jit does not support the root resolver pattern that this test uses * so the part must be rewritten to include that root resolver in `subscribe` of @@ -544,7 +544,7 @@ describe("Subscription Initialization Phase", () => { `) }); - expect(result).toEqual({ + expect(result).toMatchObject({ errors: [ { message: "test error", diff --git a/src/execution.ts b/src/execution.ts index 03b0894..5bd0596 100644 --- a/src/execution.ts +++ b/src/execution.ts @@ -34,7 +34,6 @@ import { ExecutionContext as GraphQLContext } from "graphql/execution/execute"; import { FieldNode, OperationDefinitionNode } from "graphql/language/ast"; import mapAsyncIterator from "graphql/subscription/mapAsyncIterator"; import { GraphQLTypeResolver } from "graphql/type/definition"; - import { pathToArray } from "graphql/jsutils/Path"; import { addPath, @@ -191,7 +190,6 @@ interface InternalCompiledQuery extends CompiledQuery { * @param partialOptions compilation options to tune the compiler features * @returns {CompiledQuery} the cacheable result */ - export function compileQuery( schema: GraphQLSchema, document: DocumentNode, @@ -212,7 +210,6 @@ export function compileQuery( ) { throw new Error("resolverInfoEnricher must be a function"); } - try { const options = { disablingCapturingStackErrors: false, @@ -238,14 +235,12 @@ export function compileQuery( } else { stringify = JSON.stringify; } - const getVariables = compileVariableParsing( schema, context.operation.variableDefinitions || [] ); const functionBody = compileOperation(context); - const compiledQuery: InternalCompiledQuery = { query: createBoundQuery( context, @@ -405,7 +400,6 @@ function compileOperation(context: CompilationContext) { Object.create(null), Object.create(null) ); - const topLevel = compileObjectType( context, type, @@ -417,7 +411,6 @@ function compileOperation(context: CompilationContext) { fieldMap, true ); - let body = `function query (${GLOBAL_EXECUTION_CONTEXT}) { "use strict"; `;