@@ -640,29 +640,31 @@ describe('Aggregation', function () {
640640 expect ( error ) . to . be . instanceOf ( MongoInvalidArgumentError ) ;
641641 } ) ;
642642
643- it ( `should succeed if you try to use explain flag with { readConcern: { level: 'local' }, writeConcern: { j: true } }` , async function ( ) {
643+ it ( `should fail if you try to use explain flag with { readConcern: { level: 'local' }, writeConcern: { j: true } }` , async function ( ) {
644644 const db = client . db ( ) ;
645645
646646 const collection = db . collection ( 'foo' ) ;
647647 Object . assign ( collection . s , { writeConcern : { j : true } } ) ;
648- const result = await collection
648+ const error = await collection
649649 . aggregate ( [ { $project : { _id : 0 } } , { $out : 'bar' } ] , { explain : true } )
650- . toArray ( ) ;
650+ . toArray ( )
651+ . catch ( error => error ) ;
651652
652- expect ( result ) . to . not . be . null ;
653+ expect ( error ) . to . be . instanceOf ( MongoInvalidArgumentError ) ;
653654 } ) ;
654655
655- it ( 'should succeed if you try to use explain flag with { writeConcern: { j: true } }' , async function ( ) {
656+ it ( 'should fail if you try to use explain flag with { writeConcern: { j: true } }' , async function ( ) {
656657 const db = client . db ( ) ;
657658
658659 const collection = db . collection ( 'foo' ) ;
659660 Object . assign ( collection . s , { writeConcern : { j : true } } ) ;
660661
661- const result = await collection
662+ const error = await collection
662663 . aggregate ( [ { $project : { _id : 0 } } , { $out : 'bar' } ] , { explain : true } )
663- . toArray ( ) ;
664+ . toArray ( )
665+ . catch ( error => error ) ;
664666
665- expect ( result ) . to . not . be . null ;
667+ expect ( error ) . to . be . instanceOf ( MongoInvalidArgumentError ) ;
666668 } ) ;
667669
668670 it ( 'should ensure MaxTimeMS is correctly passed down into command execution when using a cursor' , function ( done ) {
0 commit comments