File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
test/integration/node-specific Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -783,6 +783,24 @@ describe('class MongoClient', function () {
783783 expect ( client . s . activeCursors ) . to . have . lengthOf ( 0 ) ;
784784 expect ( kills ) . to . have . lengthOf ( 30 ) ;
785785 } ) ;
786+
787+ it ( 'creating cursors after close adds to activeCursors' , async ( ) => {
788+ expect ( client . s . activeCursors ) . to . have . lengthOf ( 0 ) ;
789+ await client . close ( ) ;
790+ collection . find ( { } ) ;
791+ expect ( client . s . activeCursors ) . to . have . lengthOf ( 1 ) ;
792+ } ) ;
793+
794+ it ( 'rewinding cursors after close adds to activeCursors' , async ( ) => {
795+ expect ( client . s . activeCursors ) . to . have . lengthOf ( 0 ) ;
796+ const cursor = collection . find ( { } , { batchSize : 1 } ) ;
797+ await cursor . next ( ) ;
798+ expect ( client . s . activeCursors ) . to . have . lengthOf ( 1 ) ;
799+ await client . close ( ) ;
800+ expect ( client . s . activeCursors ) . to . have . lengthOf ( 0 ) ;
801+ cursor . rewind ( ) ;
802+ expect ( client . s . activeCursors ) . to . have . lengthOf ( 1 ) ;
803+ } ) ;
786804 } ) ;
787805 } ) ;
788806
You can’t perform that action at this time.
0 commit comments