@@ -617,35 +617,5 @@ describe('Command Monitoring', function () {
617617 afterEach ( function ( done ) {
618618 client . close ( done ) ;
619619 } ) ;
620-
621- // NODE-1502
622- it ( 'should not allow mutation of internal state from commands returned by event monitoring' , function ( ) {
623- const started = [ ] ;
624- const succeeded = [ ] ;
625- client . on ( 'commandStarted' , filterForCommands ( 'insert' , started ) ) ;
626- client . on ( 'commandSucceeded' , filterForCommands ( 'insert' , succeeded ) ) ;
627- const documentToInsert = { a : { b : 1 } } ;
628- const db = client . db ( this . configuration . db ) ;
629- return db
630- . collection ( 'apm_test' )
631- . insertOne ( documentToInsert )
632- . then ( r => {
633- expect ( r ) . to . have . property ( 'insertedId' ) . that . is . an ( 'object' ) ;
634- expect ( started ) . to . have . lengthOf ( 1 ) ;
635- // Check if contents of returned document are equal to document inserted (by value)
636- expect ( documentToInsert ) . to . deep . equal ( started [ 0 ] . command . documents [ 0 ] ) ;
637- // Check if the returned document is a clone of the original. This confirms that the
638- // reference is not the same.
639- expect ( documentToInsert !== started [ 0 ] . command . documents [ 0 ] ) . to . equal ( true ) ;
640- expect ( documentToInsert . a !== started [ 0 ] . command . documents [ 0 ] . a ) . to . equal ( true ) ;
641-
642- started [ 0 ] . command . documents [ 0 ] . a . b = 2 ;
643- expect ( documentToInsert . a . b ) . to . equal ( 1 ) ;
644-
645- expect ( started [ 0 ] . commandName ) . to . equal ( 'insert' ) ;
646- expect ( started [ 0 ] . command . insert ) . to . equal ( 'apm_test' ) ;
647- expect ( succeeded ) . to . have . lengthOf ( 1 ) ;
648- } ) ;
649- } ) ;
650620 } ) ;
651621} ) ;
0 commit comments