@@ -478,37 +478,53 @@ function compareCommandStartedEvents(
478478
479479function compareCommandSucceededEvents (
480480 actual : CommandSucceededEvent ,
481- expected : ExpectedCommandEvent [ 'commandSucceededEvent' ] ,
481+ expected : NonNullable < ExpectedCommandEvent [ 'commandSucceededEvent' ] > ,
482482 entities : EntitiesMap ,
483483 prefix : string
484484) {
485- if ( expected ! . reply ) {
486- resultCheck ( actual . reply as Document , expected ! . reply , entities , [ prefix ] ) ;
485+ if ( expected . reply ) {
486+ resultCheck ( actual . reply as Document , expected . reply , entities , [ prefix ] ) ;
487487 }
488- if ( expected ! . commandName ) {
488+ if ( expected . commandName ) {
489489 expect (
490- expected ! . commandName ,
491- `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${
490+ expected . commandName ,
491+ `expected ${ prefix } .commandName to equal ${ expected . commandName } but received ${
492492 actual . commandName
493493 } `
494494 ) . to . equal ( actual . commandName ) ;
495495 }
496+ if ( expected . databaseName ) {
497+ expect (
498+ expected . databaseName ,
499+ `expected ${ prefix } .databaseName to equal ${ expected . databaseName } but received ${
500+ actual . databaseName
501+ } `
502+ ) . to . equal ( actual . databaseName ) ;
503+ }
496504}
497505
498506function compareCommandFailedEvents (
499507 actual : CommandFailedEvent ,
500- expected : ExpectedCommandEvent [ 'commandFailedEvent' ] ,
501- entities : EntitiesMap ,
508+ expected : NonNullable < ExpectedCommandEvent [ 'commandFailedEvent' ] > ,
509+ _entities : EntitiesMap ,
502510 prefix : string
503511) {
504- if ( expected ! . commandName ) {
512+ if ( expected . commandName ) {
505513 expect (
506- expected ! . commandName ,
507- `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${
514+ expected . commandName ,
515+ `expected ${ prefix } .commandName to equal ${ expected . commandName } but received ${
508516 actual . commandName
509517 } `
510518 ) . to . equal ( actual . commandName ) ;
511519 }
520+ if ( expected . databaseName ) {
521+ expect (
522+ expected . databaseName ,
523+ `expected ${ prefix } .databaseName to equal ${ expected . databaseName } but received ${
524+ actual . databaseName
525+ } `
526+ ) . to . equal ( actual . databaseName ) ;
527+ }
512528}
513529
514530function expectInstanceOf < T extends new ( ...args : any [ ] ) => any > (
0 commit comments