Skip to content

Commit

Permalink
refactor: executor methods into Executor class
Browse files Browse the repository at this point in the history
This class is exported only to assist people in implementing their own executors without duplicating too much code and should be used only as last resort for cases such as experimental syntax or if certain features could not be contributed upstream.

It is still part of the internal API and is versioned, so any changes to it are never considered breaking changes. If you still need to support multiple versions of the library, please use the `versionInfo` variable for version detection.
  • Loading branch information
yaacovCR committed Jun 22, 2021
1 parent e1eaea5 commit 6ca3878
Show file tree
Hide file tree
Showing 5 changed files with 936 additions and 860 deletions.
9 changes: 6 additions & 3 deletions src/execution/__tests__/subscribe-test.ts
Expand Up @@ -14,7 +14,7 @@ import { GraphQLInt, GraphQLString, GraphQLBoolean } from '../../type/scalars';

import { GraphQLAggregateError } from '../../error/GraphQLAggregateError';

import { buildExecutionContext, createSourceEventStream } from '../execute';
import { Executor } from '../execute';
import { subscribe } from '../subscribe';

import { SimplePubSub } from './simplePubSub';
Expand Down Expand Up @@ -410,8 +410,11 @@ describe('Subscription Initialization Phase', () => {
const document = parse('subscription { foo }');
const result = await subscribe({ schema, document });

const exeContext = buildExecutionContext({ schema, document });
expect(await createSourceEventStream(exeContext)).to.deep.equal(result);
const executor = new Executor();
const exeContext = executor.buildExecutionContext({ schema, document });
expect(await executor.createSourceEventStream(exeContext)).to.deep.equal(
result,
);
return result;
}

Expand Down

0 comments on commit 6ca3878

Please sign in to comment.