Skip to content

Commit eb13a7b

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

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
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', {

0 commit comments

Comments
 (0)