From ba5ed13f254af50d65416bc533de6c3b551047d0 Mon Sep 17 00:00:00 2001 From: Evans Hauser Date: Thu, 3 May 2018 10:48:24 -0700 Subject: [PATCH] apollo-server-express: fix tests to include error code --- .../src/apolloServerHttp.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/apollo-server-express/src/apolloServerHttp.test.ts b/packages/apollo-server-express/src/apolloServerHttp.test.ts index 1255a388249..2947c99d9e3 100644 --- a/packages/apollo-server-express/src/apolloServerHttp.test.ts +++ b/packages/apollo-server-express/src/apolloServerHttp.test.ts @@ -330,6 +330,9 @@ describe(`GraphQL-HTTP (apolloServer) tests for ${version} express`, () => { data: null, errors: [ { + extensions: { + code: 'INTERNAL_SERVER_ERROR', + }, message: 'Throws!', locations: [{ line: 1, column: 2 }], path: ['thrower'], @@ -359,6 +362,9 @@ describe(`GraphQL-HTTP (apolloServer) tests for ${version} express`, () => { expect(JSON.parse(response.text)).to.deep.equal({ errors: [ { + extensions: { + code: 'GRAPHQL_VALIDATION_FAILED', + }, message: 'Cannot query field "notExists" on type "QueryRoot".', locations: [{ line: 1, column: 2 }], }, @@ -385,6 +391,9 @@ describe(`GraphQL-HTTP (apolloServer) tests for ${version} express`, () => { expect(JSON.parse(response.text)).to.deep.equal({ errors: [ { + extensions: { + code: 'GRAPHQL_VALIDATION_FAILED', + }, message: 'Cannot query field "notExists" on type "QueryRoot".', locations: [{ line: 1, column: 2 }], }, @@ -532,6 +541,9 @@ describe(`GraphQL-HTTP (apolloServer) tests for ${version} express`, () => { expect(JSON.parse(response.text)).to.deep.equal({ errors: [ { + extensions: { + code: 'GRAPHQL_VALIDATION_FAILED', + }, message: 'AlwaysInvalidRule was really invalid!', }, ],