@@ -17,7 +17,7 @@ describe('MaxTimeMS', function () {
1717 return setupDatabase ( this . configuration ) ;
1818 } ) ;
1919
20- it ( 'Should Correctly respect the maxTimeMS property on count' , function ( done ) {
20+ it ( 'should correctly respect the maxTimeMS property on count' , function ( done ) {
2121 const configuration = this . configuration ;
2222 const client = configuration . newClient ( configuration . writeConcernMax ( ) , { maxPoolSize : 1 } ) ;
2323 client . connect ( function ( ) {
@@ -43,7 +43,7 @@ describe('MaxTimeMS', function () {
4343 } ) ;
4444 } ) ;
4545
46- it ( 'Should Correctly respect the maxTimeMS property on toArray' , {
46+ it ( 'should correctly respect the maxTimeMS property on toArray' , {
4747 metadata : {
4848 requires : {
4949 topology : [ 'single' , 'replicaset' ]
@@ -77,7 +77,7 @@ describe('MaxTimeMS', function () {
7777 }
7878 } ) ;
7979
80- it ( 'Should Correctly fail with maxTimeMS error' , {
80+ it ( 'should correctly fail with maxTimeMS error' , {
8181 // Add a tag that our runner can trigger on
8282 // in this case we are setting that node needs to be higher than 0.10.X to run
8383 metadata : {
@@ -201,11 +201,13 @@ describe('MaxTimeMS', function () {
201201 ) . to . have . lengthOf ( 27 ) ;
202202 } ) ;
203203
204+ const metadata = { requires : { mongodb : '>=5.0.0' } } ;
204205 for ( const { options, outcome } of tests ) {
205206 let optionsString = inspect ( options , { breakLength : Infinity } ) ;
206207 optionsString = optionsString . slice ( 1 , optionsString . length - 1 ) . trim ( ) ;
207208 optionsString = optionsString === '' ? 'nothing set' : optionsString ;
208209
210+ // Each test runs the same find operation, but asserts different outcomes
209211 const operation = async ( ) => {
210212 cursor = cappedCollection . find ( { _id : { $gt : 0 } } , { ...options , batchSize : 1 } ) ;
211213 const findDocOrError : { _id : number } | Error = await cursor . next ( ) . catch ( error => error ) ;
@@ -218,12 +220,12 @@ describe('MaxTimeMS', function () {
218220 } ;
219221
220222 if ( outcome . isFindError ) {
221- it ( `should error on find due to setting ${ optionsString } ` , async ( ) => {
223+ it ( `should error on find due to setting ${ optionsString } ` , metadata , async ( ) => {
222224 const { findDocOrError } = await operation ( ) ;
223225 expect ( findDocOrError ) . to . be . instanceOf ( MongoServerError ) ;
224226 } ) ;
225227 } else if ( outcome . isGetMoreError ) {
226- it ( `should error on getMore due to setting ${ optionsString } ` , async ( ) => {
228+ it ( `should error on getMore due to setting ${ optionsString } ` , metadata , async ( ) => {
227229 const { exhaustedByFind, getMoreDocOrError } = await operation ( ) ;
228230 if ( exhaustedByFind ) {
229231 expect ( getMoreDocOrError ) . to . be . instanceOf ( MongoCursorExhaustedError ) ;
@@ -232,7 +234,7 @@ describe('MaxTimeMS', function () {
232234 }
233235 } ) ;
234236 } else {
235- it ( `should create find cursor with ${ optionsString } ` , async ( ) => {
237+ it ( `should create find cursor with ${ optionsString } ` , metadata , async ( ) => {
236238 const { findDocOrError : findDoc , getMoreDocOrError : getMoreDoc } = await operation ( ) ;
237239
238240 expect ( findDoc ) . to . not . be . instanceOf ( Error ) ;
0 commit comments