From 49d0a9675253d908b299c21b5bd0652c69900a63 Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Mon, 22 May 2023 14:05:08 +0300 Subject: [PATCH] Fix tests --- .../src/getComposerFromJSONSchema.ts | 33 +++++++------------ .../test/getComposerFromSchema.test.ts | 2 +- .../loaders/json-schema/test/timeout.test.ts | 2 +- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/packages/loaders/json-schema/src/getComposerFromJSONSchema.ts b/packages/loaders/json-schema/src/getComposerFromJSONSchema.ts index 139e725a6faf7..af9f8157200ab 100644 --- a/packages/loaders/json-schema/src/getComposerFromJSONSchema.ts +++ b/packages/loaders/json-schema/src/getComposerFromJSONSchema.ts @@ -687,31 +687,22 @@ export function getComposerFromJSONSchema( ...subSchema, }; case 'Query': - if (path === '/properties/query') { - return { - output: schemaComposer.Query, - ...subSchema, - }; - } - subSchema.title += '_'; + return { + output: schemaComposer.Query, + ...subSchema, + }; break; case 'Mutation': - if (path === '/properties/mutation') { - return { - output: schemaComposer.Mutation, - ...subSchema, - }; - } - subSchema.title += '_'; + return { + output: schemaComposer.Mutation, + ...subSchema, + }; break; case 'Subscription': - if (path === '/properties/subscription') { - return { - output: schemaComposer.Subscription, - ...subSchema, - }; - } - subSchema.title += '_'; + return { + output: schemaComposer.Subscription, + ...subSchema, + }; break; } } diff --git a/packages/loaders/json-schema/test/getComposerFromSchema.test.ts b/packages/loaders/json-schema/test/getComposerFromSchema.test.ts index be9f6a745a19f..fc98b5d4a089e 100644 --- a/packages/loaders/json-schema/test/getComposerFromSchema.test.ts +++ b/packages/loaders/json-schema/test/getComposerFromSchema.test.ts @@ -766,7 +766,7 @@ type Mutation { expect(output instanceof ObjectTypeComposer).toBeTruthy(); expect((output as SchemaComposer).toSDL()).toContain( /* GraphQL */ ` -type Subscription_ { +type Subscription { foo: String } `.trim(), diff --git a/packages/loaders/json-schema/test/timeout.test.ts b/packages/loaders/json-schema/test/timeout.test.ts index 5267ac4f0678c..7f6b0511b8696 100644 --- a/packages/loaders/json-schema/test/timeout.test.ts +++ b/packages/loaders/json-schema/test/timeout.test.ts @@ -46,6 +46,6 @@ describe('Timeout', () => { } `), }); - expect(result?.errors?.[0]?.message).toContain('timeout in 300 ms'); + expect(result?.errors?.[0]?.message).toContain('The operation was aborted'); }); });