Skip to content

Commit

Permalink
Fix build after #1467 (#2014)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jul 4, 2019
1 parent d4a1362 commit 2afbf0b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
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

0 comments on commit 2afbf0b

Please sign in to comment.