From e009f527868b68e9336a58953ba659de48b28f6f Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Mon, 8 Jun 2020 18:26:48 +0000 Subject: [PATCH] chore(deps): update dependency graphql to v15 In a general sense this just updates tests to accommodate the new error conditions and schema hashes since a lot of the work has already been done in #3712 / 131c9b88. A larger note is due to explain the updating the snapshots. Those changes are due the fact that types returned by, e.g. `getImplementation`, will now be dependent on the order that those types first appear in the schema. See the referenced issues, the first of which implemented the change and the second which indicates the motivation. Ref: https://github.com/graphql/graphql-js/pull/2410 Ref: https://github.com/graphql/graphql-js/pull/2362 Ref: #3712 (131c9b8895e10317179ce9cab92d4766537) --- package-lock.json | 11 +- package.json | 2 +- .../src/__tests__/buildQueryPlan.test.ts | 160 +++++++++--------- .../src/__tests__/gateway/executor.test.ts | 2 +- .../src/__tests__/runQuery.test.ts | 2 +- 5 files changed, 87 insertions(+), 90 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9c2b21e15de..838819cb69c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10061,13 +10061,10 @@ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" }, "graphql": { - "version": "14.6.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.6.0.tgz", - "integrity": "sha512-VKzfvHEKybTKjQVpTFrA5yUq2S9ihcZvfJAtsDBBCuV6wauPu1xl/f9ehgVf0FcEJJs4vz6ysb/ZMkGigQZseg==", - "dev": true, - "requires": { - "iterall": "^1.2.2" - } + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.0.0.tgz", + "integrity": "sha512-ZyVO1xIF9F+4cxfkdhOJINM+51B06Friuv4M66W7HzUOeFd+vNzUn4vtswYINPi6sysjf1M2Ri/rwZALqgwbaQ==", + "dev": true }, "graphql-tag": { "version": "2.10.3", diff --git a/package.json b/package.json index 2e0fc00110d..d204fd8f50d 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "express": "4.17.1", "fastify": "2.14.1", "form-data": "2.5.1", - "graphql": "14.6.0", + "graphql": "15.0.0", "graphql-tag": "2.10.3", "graphql-tools": "4.0.8", "hapi": "17.8.5", diff --git a/packages/apollo-gateway/src/__tests__/buildQueryPlan.test.ts b/packages/apollo-gateway/src/__tests__/buildQueryPlan.test.ts index 52abe4def87..8b0e436d0f3 100644 --- a/packages/apollo-gateway/src/__tests__/buildQueryPlan.test.ts +++ b/packages/apollo-gateway/src/__tests__/buildQueryPlan.test.ts @@ -755,10 +755,10 @@ describe('buildQueryPlan', () => { { topProducts { __typename - ... on Book { + ... on Furniture { price } - ... on Furniture { + ... on Book { price } } @@ -793,15 +793,15 @@ describe('buildQueryPlan', () => { { topProducts { __typename - ... on Book { + ... on Furniture { price __typename - isbn + upc } - ... on Furniture { + ... on Book { price __typename - upc + isbn } } } @@ -809,22 +809,22 @@ describe('buildQueryPlan', () => { Flatten(path: "topProducts.@") { Fetch(service: "reviews") { { - ... on Book { - __typename - isbn - } ... on Furniture { __typename upc } + ... on Book { + __typename + isbn + } } => { - ... on Book { + ... on Furniture { reviews { body } } - ... on Furniture { + ... on Book { reviews { body } @@ -907,12 +907,12 @@ describe('buildQueryPlan', () => { { product(upc: "") { __typename - ... on Book { + ... on Furniture { details { country } } - ... on Furniture { + ... on Book { details { country } @@ -965,17 +965,46 @@ describe('buildQueryPlan', () => { } fragment __QueryPlanFragment_0__ on Product { __typename - ... on Book { - __typename - isbn - } ... on Furniture { __typename upc } + ... on Book { + __typename + isbn + } } }, Parallel { + Flatten(path: "topReviews.@.product") { + Fetch(service: "product") { + { + ... on Furniture { + __typename + upc + } + ... on Book { + __typename + isbn + } + } => + { + ... on Furniture { + name + price + details { + country + } + } + ... on Book { + price + details { + country + } + } + } + }, + }, Sequence { Flatten(path: "topReviews.@.product") { Fetch(service: "books") { @@ -1013,35 +1042,6 @@ describe('buildQueryPlan', () => { }, }, }, - Flatten(path: "topReviews.@.product") { - Fetch(service: "product") { - { - ... on Furniture { - __typename - upc - } - ... on Book { - __typename - isbn - } - } => - { - ... on Furniture { - name - price - details { - country - } - } - ... on Book { - price - details { - country - } - } - } - }, - }, }, }, } @@ -1151,17 +1151,46 @@ describe('buildQueryPlan', () => { } fragment __QueryPlanFragment_0__ on Product { __typename - ... on Book { - __typename - isbn - } ... on Furniture { __typename upc } + ... on Book { + __typename + isbn + } } }, Parallel { + Flatten(path: "reviews.@.product") { + Fetch(service: "product") { + { + ... on Furniture { + __typename + upc + } + ... on Book { + __typename + isbn + } + } => + { + ... on Furniture { + name + cost: price + details { + origin: country + } + } + ... on Book { + cost: price + details { + origin: country + } + } + } + }, + }, Sequence { Flatten(path: "reviews.@.product") { Fetch(service: "books") { @@ -1199,35 +1228,6 @@ describe('buildQueryPlan', () => { }, }, }, - Flatten(path: "reviews.@.product") { - Fetch(service: "product") { - { - ... on Furniture { - __typename - upc - } - ... on Book { - __typename - isbn - } - } => - { - ... on Furniture { - name - cost: price - details { - origin: country - } - } - ... on Book { - cost: price - details { - origin: country - } - } - } - }, - }, }, }, } diff --git a/packages/apollo-gateway/src/__tests__/gateway/executor.test.ts b/packages/apollo-gateway/src/__tests__/gateway/executor.test.ts index ef63f1a7d01..4680e943b07 100644 --- a/packages/apollo-gateway/src/__tests__/gateway/executor.test.ts +++ b/packages/apollo-gateway/src/__tests__/gateway/executor.test.ts @@ -28,7 +28,7 @@ describe('ApolloGateway executor', () => { }); expect(errors![0].message).toMatch( - 'Variable "$first" got invalid value "3"; Expected type Int.', + 'Variable "$first" got invalid value "3"; Int cannot represent non-integer value: "3"', ); }); diff --git a/packages/apollo-server-core/src/__tests__/runQuery.test.ts b/packages/apollo-server-core/src/__tests__/runQuery.test.ts index 87332ee4179..954b2936652 100644 --- a/packages/apollo-server-core/src/__tests__/runQuery.test.ts +++ b/packages/apollo-server-core/src/__tests__/runQuery.test.ts @@ -427,7 +427,7 @@ describe('runQuery', () => { const invocation = requestDidStart.mock.calls[0][0]; expect(invocation).toHaveProperty('schema', schema); expect(invocation).toHaveProperty( /* Shorter as a RegExp */ - 'schemaHash', expect.stringMatching(/^8ff87f3e0/)); + 'schemaHash', expect.stringMatching(/^cce9f33a/)); }); });