@@ -254,16 +254,13 @@ describe('Connection', function () {
254
254
{ requires : { topology : 'replicaset' , mongodb : '>=4.4' } } , // need to be on a streaming hello version
255
255
function ( ) {
256
256
let client : MongoClient ;
257
- let hbSuccess = 0 ;
258
257
259
258
beforeEach ( async function ( ) {
260
- client = this . configuration . newClient ( { } , { heartbeatFrequencyMS : 100 } ) ; // just so we don't have to wait so long for a hello
261
- hbSuccess = 0 ;
262
- client . on ( 'serverHeartbeatSucceeded' , ( ) => ( hbSuccess += 1 ) ) ;
259
+ // set heartbeatFrequencyMS just so we don't have to wait so long for a hello
260
+ client = this . configuration . newClient ( { } , { heartbeatFrequencyMS : 10 } ) ;
263
261
} ) ;
264
262
265
263
afterEach ( async function ( ) {
266
- hbSuccess = 0 ;
267
264
await client . close ( ) ;
268
265
} ) ;
269
266
@@ -273,6 +270,8 @@ describe('Connection', function () {
273
270
'processes all of them and emits heartbeats' ,
274
271
{ requires : { topology : 'replicaset' , mongodb : '>=4.4' } } ,
275
272
async function ( ) {
273
+ let hbSuccess = 0 ;
274
+ client . on ( 'serverHeartbeatSucceeded' , ( ) => ( hbSuccess += 1 ) ) ;
276
275
expect ( hbSuccess ) . to . equal ( 0 ) ;
277
276
278
277
await client . db ( ) . command ( { ping : 1 } ) ; // start monitoring.
@@ -292,7 +291,7 @@ describe('Connection', function () {
292
291
293
292
// All of the hb will be emitted synchronously in the next tick as the entire chunk is processed.
294
293
await processTick ( ) ;
295
- expect ( hbSuccess ) . to . be . greaterThan ( 100 ) ;
294
+ expect ( hbSuccess ) . to . be . greaterThan ( 1000 ) ;
296
295
}
297
296
) ;
298
297
}
0 commit comments