File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
test/integration/change-streams Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -636,7 +636,9 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
636636 }
637637
638638 /**
639- * Cleans up client-side resources used by the MongoCLient and . This includes:
639+ * Cleans up client-side resources used by the MongoClient.
640+ *
641+ * This includes:
640642 *
641643 * - Closes all open, unused connections (see note).
642644 * - Ends all in-use sessions with {@link ClientSession#endSession|ClientSession.endSession()}.
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ describe('Change Streams', function () {
6363 await csDb . createCollection ( 'test' ) . catch ( ( ) => null ) ;
6464 collection = csDb . collection ( 'test' ) ;
6565 changeStream = collection . watch ( ) ;
66+ changeStream . on ( 'error' , ( ) => null ) ;
6667 } ) ;
6768
6869 afterEach ( async ( ) => {
@@ -702,15 +703,19 @@ describe('Change Streams', function () {
702703
703704 const outStream = new PassThrough ( { objectMode : true } ) ;
704705
705- // @ts -expect-error: transform requires a Document return type
706- changeStream . stream ( { transform : JSON . stringify } ) . pipe ( outStream ) ;
706+ const transform = doc => ( { doc : JSON . stringify ( doc ) } ) ;
707+ changeStream
708+ . stream ( { transform } )
709+ . on ( 'error' , ( ) => null )
710+ . pipe ( outStream )
711+ . on ( 'error' , ( ) => null ) ;
707712
708713 const willBeData = once ( outStream , 'data' ) ;
709714
710715 await collection . insertMany ( [ { a : 1 } ] ) ;
711716
712717 const [ data ] = await willBeData ;
713- const parsedEvent = JSON . parse ( data ) ;
718+ const parsedEvent = JSON . parse ( data . doc ) ;
714719 expect ( parsedEvent ) . to . have . nested . property ( 'fullDocument.a' , 1 ) ;
715720
716721 outStream . destroy ( ) ;
You can’t perform that action at this time.
0 commit comments