Skip to content

Commit d0e32b5

Browse files
committed
test(7197): address review feedback
1 parent 18c8bf6 commit d0e32b5

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

test/integration/crud/find_cursor_methods.test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,16 @@ describe('Find Cursor', function () {
172172
});
173173
});
174174

175-
context('iterator', function () {
175+
context('#forEach', function () {
176176
it('should iterate each document in a cursor', async function () {
177177
const coll = client.db().collection('abstract_cursor');
178178
const cursor = coll.find({}, { batchSize: 2 });
179179

180180
const bag = [];
181-
for await (const doc of cursor) {
181+
cursor.forEach(doc => {
182182
bag.push(doc);
183-
}
183+
});
184+
184185
expect(bag).to.have.lengthOf(6);
185186
});
186187
});
@@ -415,8 +416,7 @@ describe('Find Cursor', function () {
415416

416417
await cursor.next();
417418

418-
let doc: any;
419-
while ((doc = (await cursor.next()) && doc != null)) {
419+
while ((await cursor.next()) != null) {
420420
/** empty */
421421
}
422422

@@ -433,8 +433,7 @@ describe('Find Cursor', function () {
433433

434434
await cursor.next();
435435

436-
let doc: any;
437-
while ((doc = (await cursor.next()) && doc != null)) {
436+
while ((await cursor.next()) != null) {
438437
/** empty */
439438
}
440439

@@ -632,8 +631,7 @@ describe('Find Cursor', function () {
632631

633632
await cursor.next();
634633

635-
let doc: any;
636-
while ((doc = (await cursor.next()) && doc != null)) {
634+
while ((await cursor.next()) != null) {
637635
/** empty */
638636
}
639637

0 commit comments

Comments
 (0)