@@ -254,16 +254,13 @@ describe('Connection', function () {
254254 { requires : { topology : 'replicaset' , mongodb : '>=4.4' } } , // need to be on a streaming hello version
255255 function ( ) {
256256 let client : MongoClient ;
257- let hbSuccess = 0 ;
258257
259258 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 } ) ;
263261 } ) ;
264262
265263 afterEach ( async function ( ) {
266- hbSuccess = 0 ;
267264 await client . close ( ) ;
268265 } ) ;
269266
@@ -273,6 +270,8 @@ describe('Connection', function () {
273270 'processes all of them and emits heartbeats' ,
274271 { requires : { topology : 'replicaset' , mongodb : '>=4.4' } } ,
275272 async function ( ) {
273+ let hbSuccess = 0 ;
274+ client . on ( 'serverHeartbeatSucceeded' , ( ) => ( hbSuccess += 1 ) ) ;
276275 expect ( hbSuccess ) . to . equal ( 0 ) ;
277276
278277 await client . db ( ) . command ( { ping : 1 } ) ; // start monitoring.
@@ -292,7 +291,7 @@ describe('Connection', function () {
292291
293292 // All of the hb will be emitted synchronously in the next tick as the entire chunk is processed.
294293 await processTick ( ) ;
295- expect ( hbSuccess ) . to . be . greaterThan ( 100 ) ;
294+ expect ( hbSuccess ) . to . be . greaterThan ( 1000 ) ;
296295 }
297296 ) ;
298297 }
0 commit comments