Skip to content

Commit 59bf247

Browse files
committed
f1xes
1 parent 4ef45f6 commit 59bf247

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

packages/graphiql/test/afterDevServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// eslint-disable-next-line import-x/no-extraneous-dependencies
22
const { useServer } = require('graphql-ws/lib/use/ws');
33
const { Server: WebSocketServer } = require('ws');
4-
const schema = require('./schema');
4+
const { schema } = require('./schema');
55

66
module.exports = function afterDevServer(_app, _server, _compiler) {
77
const wsServer = new WebSocketServer({

packages/graphiql/test/e2e-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ app.use('/graphql/stream', (req, res, next) => {
6767
});
6868

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

packages/graphiql/test/schema.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* This source code is licensed under the MIT license found in the
66
* LICENSE file in the root directory of this source tree.
77
*/
8+
9+
const graphql = require('graphql');
10+
811
const {
912
GraphQLSchema,
1013
GraphQLObjectType,
@@ -22,7 +25,12 @@ const {
2225
GraphQLStreamDirective,
2326
specifiedDirectives,
2427
version,
25-
} = require('graphql');
28+
} = graphql;
29+
30+
const directives =
31+
parseInt(version, 10) > 16
32+
? [...specifiedDirectives, GraphQLDeferDirective, GraphQLStreamDirective]
33+
: specifiedDirectives;
2634

2735
// Test Schema
2836
const TestEnum = new GraphQLEnumType({
@@ -384,20 +392,12 @@ const TestSubscriptionType = new GraphQLObjectType({
384392
},
385393
});
386394

387-
const schemaConfig = {
395+
const myTestSchema = new GraphQLSchema({
388396
query: TestType,
389397
mutation: TestMutationType,
390398
subscription: TestSubscriptionType,
391399
description: 'This is a test schema for GraphiQL',
392-
};
393-
394-
exports.schema = new GraphQLSchema({
395-
...schemaConfig,
396-
directives:
397-
parseInt(version, 10) > 16
398-
? [...specifiedDirectives, GraphQLDeferDirective, GraphQLStreamDirective]
399-
: specifiedDirectives,
400+
directives,
400401
});
401402

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

0 commit comments

Comments
 (0)