@@ -2389,27 +2389,31 @@ describe('Find', function () {
23892389 } ) ;
23902390 } ) ;
23912391
2392- it ( 'regression test (NODE-6878): CursorResponse.emptyGetMore contains all CursorResponse fields' , async function ( ) {
2393- const collection = client . db ( 'rewind-regression' ) . collection ( 'bar' ) ;
2392+ it (
2393+ 'regression test (NODE-6878): CursorResponse.emptyGetMore contains all CursorResponse fields' ,
2394+ { requires : { topology : 'sharded' } } ,
2395+ async function ( ) {
2396+ const collection = client . db ( 'rewind-regression' ) . collection ( 'bar' ) ;
23942397
2395- await collection . deleteMany ( { } ) ;
2396- await collection . insertMany ( Array . from ( { length : 4 } , ( _ , i ) => ( { x : i } ) ) ) ;
2398+ await collection . deleteMany ( { } ) ;
2399+ await collection . insertMany ( Array . from ( { length : 4 } , ( _ , i ) => ( { x : i } ) ) ) ;
23972400
2398- const getMoreSpy = sinon . spy ( CursorResponse , 'emptyGetMore' , [ 'get' ] ) ;
2401+ const getMoreSpy = sinon . spy ( CursorResponse , 'emptyGetMore' , [ 'get' ] ) ;
23992402
2400- const cursor = collection . find ( { } , { batchSize : 1 , limit : 3 } ) ;
2401- // emptyGetMore is used internally after limit + 1 documents have been iterated
2402- await cursor . next ( ) ;
2403- await cursor . next ( ) ;
2404- await cursor . next ( ) ;
2405- await cursor . next ( ) ;
2403+ const cursor = collection . find ( { } , { batchSize : 1 , limit : 3 } ) ;
2404+ // emptyGetMore is used internally after limit + 1 documents have been iterated
2405+ await cursor . next ( ) ;
2406+ await cursor . next ( ) ;
2407+ await cursor . next ( ) ;
2408+ await cursor . next ( ) ;
24062409
2407- // assert that `emptyGetMore` is called. if it is not, this test
2408- // always passes, even without the fix in NODE-6878.
2409- expect ( getMoreSpy . get ) . to . have . been . called ;
2410+ // assert that `emptyGetMore` is called. if it is not, this test
2411+ // always passes, even without the fix in NODE-6878.
2412+ expect ( getMoreSpy . get ) . to . have . been . called ;
24102413
2411- cursor . rewind ( ) ;
2414+ cursor . rewind ( ) ;
24122415
2413- await cursor . toArray ( ) ;
2414- } ) ;
2416+ await cursor . toArray ( ) ;
2417+ }
2418+ ) ;
24152419} ) ;
0 commit comments