Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions src/execution/incremental/__tests__/stream-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3851,25 +3851,12 @@ describe('Execute: stream directive (cancellation)', () => {
abortController.abort();
await resolveOnNextTick();

let firstResult:
| IteratorResult<SubsequentIncrementalExecutionResult>
| undefined;
try {
firstResult =
(await nextResultPromise) as IteratorResult<SubsequentIncrementalExecutionResult>;
} catch (error) {
expect(error).to.be.instanceOf(Error);
expect((error as Error).message).to.equal('This operation was aborted');
}
if (firstResult && !firstResult.done) {
try {
const followUp = await iterator.next();
expect(followUp.done).to.equal(true);
} catch (error) {
expect(error).to.be.instanceOf(Error);
expect((error as Error).message).to.equal('This operation was aborted');
}
}
await expectPromise(nextResultPromise).toRejectWith(
'This operation was aborted',
);
await resolveOnNextTick();
const followUp = await iterator.next();
expect(followUp.done).to.equal(true);
expect(streamReturnCount).to.equal(1);

const priorStreamReturnCount = streamReturnCount;
Expand Down
25 changes: 6 additions & 19 deletions src/execution/legacyIncremental/__tests__/legacy-stream-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3640,25 +3640,12 @@ describe('Execute: stream directive (legacy cancellation)', () => {
abortController.abort();
await resolveOnNextTick();

let firstResult:
| IteratorResult<LegacySubsequentIncrementalExecutionResult>
| undefined;
try {
firstResult =
(await nextResultPromise) as IteratorResult<LegacySubsequentIncrementalExecutionResult>;
} catch (error) {
expect(error).to.be.instanceOf(Error);
expect((error as Error).message).to.equal('This operation was aborted');
}
if (firstResult && !firstResult.done) {
try {
const followUp = await iterator.next();
expect(followUp.done).to.equal(true);
} catch (error) {
expect(error).to.be.instanceOf(Error);
expect((error as Error).message).to.equal('This operation was aborted');
}
}
await expectPromise(nextResultPromise).toRejectWith(
'This operation was aborted',
);
await resolveOnNextTick();
const followUp = await iterator.next();
expect(followUp.done).to.equal(true);
expect(streamReturnCount).to.equal(1);

const priorStreamReturnCount = streamReturnCount;
Expand Down
Loading