File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -4668,4 +4668,30 @@ describe('Cursor', function() {
4668
4668
} ) ;
4669
4669
} ) ;
4670
4670
} ) ;
4671
+
4672
+ describe ( '#clone' , function ( ) {
4673
+ it ( 'removes the existing session from the cloned cursor' , function ( done ) {
4674
+ const configuration = this . configuration ;
4675
+ const client = configuration . newClient ( ) ;
4676
+ client . connect ( error => {
4677
+ expect ( error ) . to . not . exist ;
4678
+ this . defer ( ( ) => client . close ( ) ) ;
4679
+
4680
+ const docs = [ { name : 'test1' } , { name : 'test2' } ] ;
4681
+ const coll = client . db ( configuration . db ) . collection ( 'cursor_session_mapping' ) ;
4682
+ coll . insertMany ( docs , err => {
4683
+ expect ( err ) . to . not . exist ;
4684
+ const cursor = coll . find ( { } , { batchSize : 1 } ) ;
4685
+ cursor . next ( ( er , doc ) => {
4686
+ expect ( er ) . to . not . exist ;
4687
+ expect ( doc ) . to . exist ;
4688
+ const clonedCursor = cursor . clone ( ) ;
4689
+ expect ( clonedCursor . cursorState . session ) . to . not . exist ;
4690
+ cursor . close ( ) ;
4691
+ done ( ) ;
4692
+ } ) ;
4693
+ } ) ;
4694
+ } ) ;
4695
+ } ) ;
4696
+ } ) ;
4671
4697
} ) ;
You can’t perform that action at this time.
0 commit comments