@@ -461,54 +461,64 @@ function compareCommandStartedEvents(
461461 if ( expected ! . commandName ) {
462462 expect (
463463 expected ! . commandName ,
464- `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${
465- actual . commandName
464+ `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${ actual . commandName
466465 } `
467466 ) . to . equal ( actual . commandName ) ;
468467 }
469468 if ( expected ! . databaseName ) {
470469 expect (
471470 expected ! . databaseName ,
472- `expected ${ prefix } .databaseName to equal ${ expected ! . databaseName } but received ${
473- actual . databaseName
471+ `expected ${ prefix } .databaseName to equal ${ expected ! . databaseName } but received ${ actual . databaseName
474472 } `
475473 ) . to . equal ( actual . databaseName ) ;
476474 }
477475}
478476
479477function compareCommandSucceededEvents (
480478 actual : CommandSucceededEvent ,
481- expected : ExpectedCommandEvent [ 'commandSucceededEvent' ] ,
479+ expected : NonNullable < ExpectedCommandEvent [ 'commandSucceededEvent' ] > ,
482480 entities : EntitiesMap ,
483481 prefix : string
484482) {
485- if ( expected ! . reply ) {
486- resultCheck ( actual . reply as Document , expected ! . reply , entities , [ prefix ] ) ;
483+ if ( expected . reply ) {
484+ resultCheck ( actual . reply as Document , expected . reply , entities , [ prefix ] ) ;
487485 }
488- if ( expected ! . commandName ) {
486+ if ( expected . commandName ) {
489487 expect (
490- expected ! . commandName ,
491- `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${
492- actual . commandName
488+ expected . commandName ,
489+ `expected ${ prefix } .commandName to equal ${ expected . commandName } but received ${ actual . commandName
493490 } `
494491 ) . to . equal ( actual . commandName ) ;
495492 }
493+ if ( expected . databaseName ) {
494+ expect (
495+ expected . databaseName ,
496+ `expected ${ prefix } .databaseName to equal ${ expected . databaseName } but received ${ actual . databaseName
497+ } `
498+ ) . to . equal ( actual . databaseName ) ;
499+ }
496500}
497501
498502function compareCommandFailedEvents (
499503 actual : CommandFailedEvent ,
500- expected : ExpectedCommandEvent [ 'commandFailedEvent' ] ,
501- entities : EntitiesMap ,
504+ expected : NonNullable < ExpectedCommandEvent [ 'commandFailedEvent' ] > ,
505+ _entities : EntitiesMap ,
502506 prefix : string
503507) {
504- if ( expected ! . commandName ) {
508+ if ( expected . commandName ) {
505509 expect (
506- expected ! . commandName ,
507- `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${
508- actual . commandName
510+ expected . commandName ,
511+ `expected ${ prefix } .commandName to equal ${ expected . commandName } but received ${ actual . commandName
509512 } `
510513 ) . to . equal ( actual . commandName ) ;
511514 }
515+ if ( expected . databaseName ) {
516+ expect (
517+ expected . databaseName ,
518+ `expected ${ prefix } .databaseName to equal ${ expected . databaseName } but received ${ actual . databaseName
519+ } `
520+ ) . to . equal ( actual . databaseName ) ;
521+ }
512522}
513523
514524function expectInstanceOf < T extends new ( ...args : any [ ] ) => any > (
0 commit comments