Skip to content

Commit 16deee1

Browse files
committed
fix: revert change to abstract cursor async iterator
1 parent e5ad264 commit 16deee1

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/change_stream.ts

-1
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,6 @@ export class ChangeStream<
726726
}, callback);
727727
}
728728

729-
// TODO(andymina): ask about never as third template parameter
730729
async *[Symbol.asyncIterator](): AsyncGenerator<TChange, void, never> {
731730
if (this.closed) {
732731
return;

src/cursor/abstract_cursor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export abstract class AbstractCursor<
296296
return bufferedDocs;
297297
}
298298

299-
[Symbol.asyncIterator](): AsyncIterator<TSchema, void, never> {
299+
[Symbol.asyncIterator](): AsyncIterator<TSchema, void> {
300300
async function* nativeAsyncIterator(this: AbstractCursor<TSchema>) {
301301
if (this.closed) {
302302
return;

test/integration/change-streams/change_stream.test.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
ReadPreference,
2323
ResumeToken
2424
} from '../../../src';
25-
import { next } from '../../../src/cursor/abstract_cursor';
2625
import { isHello } from '../../../src/utils';
2726
import * as mock from '../../tools/mongodb-mock/index';
2827
import {
@@ -953,7 +952,6 @@ describe('Change Streams', function () {
953952
'This test only worked because of timing, changeStream.close does not remove the change listener';
954953
});
955954

956-
// TODO(andymina): ask about testing word semantics here
957955
context('iterator api', function () {
958956
describe('#tryNext()', function () {
959957
it('should return null on single iteration of empty cursor', {
@@ -1092,7 +1090,7 @@ describe('Change Streams', function () {
10921090
}
10931091
);
10941092

1095-
it.only(
1093+
it(
10961094
'can be used with raw iterator API',
10971095
{ requires: { topology: '!single' } },
10981096
async function () {
@@ -1112,7 +1110,7 @@ describe('Change Streams', function () {
11121110
const { fullDocument } = change.value;
11131111
expect(fullDocument.city).to.equal(docs[1].city);
11141112
} catch (error) {
1115-
expect.fail('Async could not be used with raw iterator API')
1113+
expect.fail('Async could not be used with raw iterator API');
11161114
}
11171115
}
11181116
);
@@ -2405,7 +2403,7 @@ describe('ChangeStream resumability', function () {
24052403

24062404
await collection.insertOne({ city: 'New York City' });
24072405
try {
2408-
const change = await changeStreamIterator.next();
2406+
await changeStreamIterator.next();
24092407
expect.fail(
24102408
'Change stream did not throw unresumable error and did not produce any events'
24112409
);

0 commit comments

Comments
 (0)