Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build after #1467 #2014

Merged
merged 1 commit into from Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/subscription/__tests__/subscribe-test.js
Expand Up @@ -434,9 +434,9 @@ describe('Subscription Initialization Phase', () => {

it('resolves to an error for source event stream resolver errors', async () => {
// Returning an error
const subscriptionReturningErrorSchema = emailSchemaWithResolvers(() => {
return new Error('test error');
});
const subscriptionReturningErrorSchema = emailSchemaWithResolvers(
() => new Error('test error'),
);
await testReportsError(subscriptionReturningErrorSchema);

// Throwing an error
Expand All @@ -446,10 +446,8 @@ describe('Subscription Initialization Phase', () => {
await testReportsError(subscriptionThrowingErrorSchema);

// Resolving to an error
const subscriptionResolvingErrorSchema = emailSchemaWithResolvers(
async () => {
return new Error('test error');
},
const subscriptionResolvingErrorSchema = emailSchemaWithResolvers(() =>
Promise.resolve(new Error('test error')),
);
await testReportsError(subscriptionResolvingErrorSchema);

Expand Down Expand Up @@ -1013,6 +1011,7 @@ describe('Subscription Publish Phase', () => {
`),
);

// $FlowFixMe
const payload1 = await subscription.next();
expect(payload1).to.deep.equal({
done: false,
Expand Down
19 changes: 9 additions & 10 deletions src/subscription/subscribe.js
Expand Up @@ -151,16 +151,15 @@ function subscribeImpl(

// Resolve the Source Stream, then map every source value to a
// ExecutionResult value as described above.
return sourcePromise.then(
resultOrStream =>
// Note: Flow can't refine isAsyncIterable, so explicit casts are used.
isAsyncIterable(resultOrStream)
? mapAsyncIterator(
((resultOrStream: any): AsyncIterable<mixed>),
mapSourceToResponse,
reportGraphQLError,
)
: ((resultOrStream: any): ExecutionResult),
return sourcePromise.then(resultOrStream =>
// Note: Flow can't refine isAsyncIterable, so explicit casts are used.
isAsyncIterable(resultOrStream)
? mapAsyncIterator(
((resultOrStream: any): AsyncIterable<mixed>),
mapSourceToResponse,
reportGraphQLError,
)
: ((resultOrStream: any): ExecutionResult),
);
}

Expand Down