@@ -493,37 +493,21 @@ function assertTopologyDescriptionOutcomeExpectations(
493
493
}
494
494
}
495
495
496
- if ( outcome . setName != null ) {
497
- expect ( description ) . to . have . property ( 'setName' , outcome . setName ) ;
498
- } else {
499
- expect ( description ) . to . not . have . property ( 'setName' ) ;
500
- }
501
-
502
- if ( outcome . maxSetVersion != null ) {
503
- expect ( description ) . to . have . property ( 'maxSetVersion' , outcome . maxSetVersion ) ;
504
- } else {
505
- expect ( description ) . to . not . have . property ( 'maxSetVersion' ) ;
506
- }
507
-
508
496
if ( outcome . maxElectionId != null ) {
509
497
expect ( description ) . to . have . property ( 'maxElectionId' ) . that . is . instanceOf ( ObjectId ) ;
510
- const driverMaxId = description . maxElectionId . toString ( 'hex' ) ;
498
+ const driverMaxId = description . maxElectionId ? .toString ( 'hex' ) ;
511
499
const testMaxId = outcome . maxElectionId . toString ( 'hex' ) ;
512
500
// Much easier to debug a hex string mismatch
513
501
expect ( driverMaxId ) . to . equal ( testMaxId ) ;
514
502
} else {
515
- expect ( description ) . to . not . have . property ( 'maxElectionId' ) ;
516
- }
517
-
518
- if ( outcome . compatible != null ) {
519
- expect ( description ) . to . have . property ( 'compatible' , outcome . compatible ) ;
520
- } else {
521
- expect ( description ) . to . have . property ( 'compatible' , true ) ;
503
+ expect ( description ) . to . have . property ( 'maxElectionId' , null ) ;
522
504
}
523
505
524
- // logicalSessionTimeoutMinutes is always defined
506
+ expect ( description ) . to . have . property ( 'setName' , outcome . setName ?? null ) ;
507
+ expect ( description ) . to . have . property ( 'maxSetVersion' , outcome . maxSetVersion ?? null ) ;
508
+ expect ( description ) . to . have . property ( 'compatible' , outcome . compatible ?? true ) ;
525
509
expect ( description ) . to . have . property (
526
510
'logicalSessionTimeoutMinutes' ,
527
- outcome . logicalSessionTimeoutMinutes ?? undefined
511
+ outcome . logicalSessionTimeoutMinutes ?? null
528
512
) ;
529
513
}
0 commit comments