Skip to content

Commit 0b7ba8c

Browse files
committed
test: rewind and creation after close
1 parent 1c05e00 commit 0b7ba8c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/integration/node-specific/mongo_client.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,24 @@ describe('class MongoClient', function () {
783783
expect(client.s.activeCursors).to.have.lengthOf(0);
784784
expect(kills).to.have.lengthOf(30);
785785
});
786+
787+
it('creating cursors after close adds to activeCursors', async () => {
788+
expect(client.s.activeCursors).to.have.lengthOf(0);
789+
await client.close();
790+
collection.find({});
791+
expect(client.s.activeCursors).to.have.lengthOf(1);
792+
});
793+
794+
it('rewinding cursors after close adds to activeCursors', async () => {
795+
expect(client.s.activeCursors).to.have.lengthOf(0);
796+
const cursor = collection.find({}, { batchSize: 1 });
797+
await cursor.next();
798+
expect(client.s.activeCursors).to.have.lengthOf(1);
799+
await client.close();
800+
expect(client.s.activeCursors).to.have.lengthOf(0);
801+
cursor.rewind();
802+
expect(client.s.activeCursors).to.have.lengthOf(1);
803+
});
786804
});
787805
});
788806

0 commit comments

Comments
 (0)