Skip to content

Commit

Permalink
f1xes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina committed Aug 24, 2024
1 parent 4ef45f6 commit 59bf247
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/graphiql/test/afterDevServer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line import-x/no-extraneous-dependencies
const { useServer } = require('graphql-ws/lib/use/ws');
const { Server: WebSocketServer } = require('ws');
const schema = require('./schema');
const { schema } = require('./schema');

module.exports = function afterDevServer(_app, _server, _compiler) {
const wsServer = new WebSocketServer({
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql/test/e2e-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ app.use('/graphql/stream', (req, res, next) => {
});

// Create the GraphQL over SSE handler
const sseHandler = createHandler({ schema: sseSchema });
const sseHandler = createHandler({ schema, execute: customExecute });
// Serve all methods on `/graphql/stream`
app.use('/graphql/stream', sseHandler);

Expand Down
24 changes: 12 additions & 12 deletions packages/graphiql/test/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const graphql = require('graphql');

const {
GraphQLSchema,
GraphQLObjectType,
Expand All @@ -22,7 +25,12 @@ const {
GraphQLStreamDirective,
specifiedDirectives,
version,
} = require('graphql');
} = graphql;

const directives =
parseInt(version, 10) > 16
? [...specifiedDirectives, GraphQLDeferDirective, GraphQLStreamDirective]
: specifiedDirectives;

// Test Schema
const TestEnum = new GraphQLEnumType({
Expand Down Expand Up @@ -384,20 +392,12 @@ const TestSubscriptionType = new GraphQLObjectType({
},
});

const schemaConfig = {
const myTestSchema = new GraphQLSchema({
query: TestType,
mutation: TestMutationType,
subscription: TestSubscriptionType,
description: 'This is a test schema for GraphiQL',
};

exports.schema = new GraphQLSchema({
...schemaConfig,
directives:
parseInt(version, 10) > 16
? [...specifiedDirectives, GraphQLDeferDirective, GraphQLStreamDirective]
: specifiedDirectives,
directives,
});

// Same schema but without defer/stream directives
exports.sseSchema = new GraphQLSchema(schemaConfig);
exports.schema = myTestSchema;

0 comments on commit 59bf247

Please sign in to comment.