Skip to content

Commit cb5bd62

Browse files
committed
test: make sure the getMore is started
1 parent 4add48c commit cb5bd62

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

test/integration/crud/misc_cursors.test.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,18 +1865,22 @@ describe('Cursor', function () {
18651865

18661866
await cursor.next();
18671867
await cursor.next();
1868+
1869+
const nextCommand = once(client, 'commandStarted');
18681870
// will block for maxAwaitTimeMS (except we are closing the client)
18691871
const rejectedEarlyBecauseClientClosed = cursor.next().catch(error => error);
18701872

1873+
for (
1874+
let [{ commandName }] = await nextCommand;
1875+
commandName !== 'getMore';
1876+
[{ commandName }] = await once(client, 'commandStarted')
1877+
);
1878+
18711879
await client.close();
18721880
expect(cursor).to.have.property('closed', true);
18731881

18741882
const error = await rejectedEarlyBecauseClientClosed;
1875-
if (this.configuration.topologyType === 'LoadBalanced') {
1876-
expect(error).to.be.instanceOf(MongoClientClosedError);
1877-
} else {
1878-
expect(error).to.be.null;
1879-
}
1883+
expect(error).to.be.instanceOf(MongoClientClosedError);
18801884
});
18811885

18821886
it('shouldAwaitData', {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
Db,
1313
getTopology,
1414
MongoClient,
15-
MongoClientClosedError,
1615
MongoNotConnectedError,
1716
MongoServerSelectionError,
1817
ReadPreference,

0 commit comments

Comments
 (0)