MCPcopy
hub / github.com/graphql/graphql-js / completeAsync

Function completeAsync

src/execution/incremental/__tests__/stream-test.ts:172–199  ·  view source on GitHub ↗
(
  document: DocumentNode,
  numCalls: number,
  rootValue: unknown = {},
)

Source from the content-addressed store, hash-verified

170}
171
172async function completeAsync(
173 document: DocumentNode,
174 numCalls: number,
175 rootValue: unknown = {},
176) {
177 const result = await experimentalExecuteIncrementally({
178 schema,
179 document,
180 rootValue,
181 });
182
183 assert('initialResult' in result);
184
185 const iterator = result.subsequentResults[Symbol.asyncIterator]();
186
187 const promises: Array<
188 PromiseOrValue<
189 IteratorResult<
190 InitialIncrementalExecutionResult | SubsequentIncrementalExecutionResult
191 >
192 >
193 > = [{ done: false, value: result.initialResult }];
194 for (let i = 0; i < numCalls; i++) {
195 promises.push(iterator.next());
196 }
197 // eslint-disable-next-line @typescript-eslint/await-thenable
198 return Promise.all(promises);
199}
200
201describe('Execute: stream directive', () => {
202 it('Can stream a list field', async () => {

Callers 1

stream-test.tsFile · 0.70

Calls 1

Tested by

no test coverage detected