@@ -640,29 +640,31 @@ describe('Aggregation', function () {
640
640
expect ( error ) . to . be . instanceOf ( MongoInvalidArgumentError ) ;
641
641
} ) ;
642
642
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 ( ) {
644
644
const db = client . db ( ) ;
645
645
646
646
const collection = db . collection ( 'foo' ) ;
647
647
Object . assign ( collection . s , { writeConcern : { j : true } } ) ;
648
- const result = await collection
648
+ const error = await collection
649
649
. aggregate ( [ { $project : { _id : 0 } } , { $out : 'bar' } ] , { explain : true } )
650
- . toArray ( ) ;
650
+ . toArray ( )
651
+ . catch ( error => error ) ;
651
652
652
- expect ( result ) . to . not . be . null ;
653
+ expect ( error ) . to . be . instanceOf ( MongoInvalidArgumentError ) ;
653
654
} ) ;
654
655
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 ( ) {
656
657
const db = client . db ( ) ;
657
658
658
659
const collection = db . collection ( 'foo' ) ;
659
660
Object . assign ( collection . s , { writeConcern : { j : true } } ) ;
660
661
661
- const result = await collection
662
+ const error = await collection
662
663
. aggregate ( [ { $project : { _id : 0 } } , { $out : 'bar' } ] , { explain : true } )
663
- . toArray ( ) ;
664
+ . toArray ( )
665
+ . catch ( error => error ) ;
664
666
665
- expect ( result ) . to . not . be . null ;
667
+ expect ( error ) . to . be . instanceOf ( MongoInvalidArgumentError ) ;
666
668
} ) ;
667
669
668
670
it ( 'should ensure MaxTimeMS is correctly passed down into command execution when using a cursor' , function ( done ) {
0 commit comments