Skip to content

Commit

Permalink
use invariant
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Mar 21, 2021
1 parent e272823 commit ace3509
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/execution/__tests__/stream-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,13 @@ async function completeAsync(document, numCalls) {

const result = await execute({ schema, document, rootValue: {} });

if (isAsyncIterable(result)) {
const promises = [];
for (let i = 0; i < numCalls; i++) {
promises.push(result.next());
}
return Promise.all(promises);
invariant(isAsyncIterable(result));

const promises = [];
for (let i = 0; i < numCalls; i++) {
promises.push(result.next());
}
return result;
return Promise.all(promises);
}

describe('Execute: stream directive', () => {
Expand Down

0 comments on commit ace3509

Please sign in to comment.