@@ -459,19 +459,19 @@ function validateExpectations(commandEvents, spec, savedSessionData) {
459
459
const rawExpectedEvents = spec . expectations . map ( x => x . command_started_event ) ;
460
460
const expectedEvents = normalizeCommandShapes ( rawExpectedEvents ) ;
461
461
462
- expect ( actualEvents . map ( ( { commandName } ) => commandName ) ) . to . deep . equal (
463
- expectedEvents . map ( ( { commandName } ) => commandName )
464
- ) ;
462
+ for ( const [ idx , expectedEvent ] of expectedEvents . entries ( ) ) {
463
+ const actualEvent = actualEvents [ idx ] ;
465
464
466
- expect ( actualEvents . map ( ( { databaseName } ) => databaseName ) ) . to . deep . equal (
467
- expectedEvents . map ( ( { databaseName } ) => databaseName )
468
- ) ;
465
+ if ( typeof expectedEvent . commandName === 'string' ) {
466
+ expect ( actualEvent ) . to . have . property ( 'commandName' , expectedEvent . commandName ) ;
467
+ }
469
468
470
- for ( const [ idx , expected ] of expectedEvents . entries ( ) ) {
471
- const actual = actualEvents [ idx ] ;
469
+ if ( typeof expectedEvent . databaseName === 'string' ) {
470
+ expect ( actualEvent ) . to . have . property ( 'databaseName' , expectedEvent . databaseName ) ;
471
+ }
472
472
473
- const actualCommand = actual . command ;
474
- const expectedCommand = expected . command ;
473
+ const actualCommand = actualEvent . command ;
474
+ const expectedCommand = expectedEvent . command ;
475
475
if ( expectedCommand . sort ) {
476
476
// TODO(NODE-3235): This is a workaround that works because all sorts in the specs
477
477
// are objects with one key; ideally we'd want to adjust the spec definitions
0 commit comments