From a647e4875fb3f46c2010abbb875a78b0ed9f4f5a Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Mon, 8 Jun 2020 14:11:49 +0300 Subject: [PATCH] Fix tests for graphql-js v15.1.0 --- package.json | 6 ++--- .../loaders/schema/schema-from-json.spec.ts | 26 ++++++++++--------- packages/utils/tests/directives.test.ts | 1 - yarn.lock | 8 +++--- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index ab915a53b99..3043836d30e 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "eslint-plugin-promise": "4.2.1", "eslint-plugin-standard": "4.0.1", "fs-extra": "9.0.1", - "graphql": "15.0.0", + "graphql": "15.1.0", "lint-staged": "10.2.9", "nock": "12.0.3", "husky": "4.2.5", @@ -79,6 +79,6 @@ "./website" ], "resolutions": { - "graphql": "15.0.0" + "graphql": "15.1.0" } -} \ No newline at end of file +} diff --git a/packages/load/tests/loaders/schema/schema-from-json.spec.ts b/packages/load/tests/loaders/schema/schema-from-json.spec.ts index b48eccdc415..985037fec9f 100644 --- a/packages/load/tests/loaders/schema/schema-from-json.spec.ts +++ b/packages/load/tests/loaders/schema/schema-from-json.spec.ts @@ -27,18 +27,20 @@ describe('Schema From Export', () => { expect(isSchema(schema)).toBeTruthy(); const introspectionSchema = require('./test-files/githunt.json').__schema; for (const typeName in schema.getTypeMap()) { - const type = schema.getType(typeName); - const introspectionType = introspectionSchema.types.find((t: { name: string; }) => t.name === typeName); - if (type.description || introspectionType.description) { - expect(type.description).toBe(introspectionType.description); - } - if (!typeName.startsWith('__') && (type instanceof GraphQLObjectType || type instanceof GraphQLInterfaceType)) { - const fieldMap = type.getFields(); - for (const fieldName in fieldMap) { - const field = fieldMap[fieldName]; - const introspectionField = introspectionType.fields.find((f: { name: string; }) => f.name === fieldName); - if (field.description || introspectionField.description) { - expect(field.description.trim()).toBe(introspectionField.description.trim()); + if (!typeName.startsWith('_')) { + const type = schema.getType(typeName); + const introspectionType = introspectionSchema.types.find((t: { name: string; }) => t.name === typeName); + if (type.description || introspectionType.description) { + expect(type.description).toBe(introspectionType.description); + } + if ('getFields' in type) { + const fieldMap = type.getFields(); + for (const fieldName in fieldMap) { + const field = fieldMap[fieldName]; + const introspectionField = introspectionType.fields.find((f: { name: string; }) => f.name === fieldName); + if (field.description || introspectionField.description) { + expect(field.description.trim()).toBe(introspectionField.description.trim()); + } } } } diff --git a/packages/utils/tests/directives.test.ts b/packages/utils/tests/directives.test.ts index 80081800ad7..735e860951c 100644 --- a/packages/utils/tests/directives.test.ts +++ b/packages/utils/tests/directives.test.ts @@ -250,7 +250,6 @@ describe('@directives', () => { }); expect(schema.getType('DateFormat')).toBeDefined(); - expect(schema.getDirectives()).toHaveLength(4); expect(schema.getDirective('date')).toBeDefined(); }); diff --git a/yarn.lock b/yarn.lock index c3f23335c4a..f7c3bc04ce6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6488,10 +6488,10 @@ graphql-upload@^8.0.2: http-errors "^1.7.3" object-path "^0.11.4" -graphql@15.0.0, graphql@^14.5.3: - version "15.0.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.0.0.tgz#042a5eb5e2506a2e2111ce41eb446a8e570b8be9" - integrity sha512-ZyVO1xIF9F+4cxfkdhOJINM+51B06Friuv4M66W7HzUOeFd+vNzUn4vtswYINPi6sysjf1M2Ri/rwZALqgwbaQ== +graphql@15.1.0, graphql@^14.5.3: + version "15.1.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.1.0.tgz#b93e28de805294ec08e1630d901db550cb8960a1" + integrity sha512-0TVyfOlCGhv/DBczQkJmwXOK6fjWkjzY3Pt7wY8i0gcYXq8aogG3weCsg48m72lywKSeOqedEHvVPOvZvSD51Q== gray-matter@^4.0.2: version "4.0.2"