@@ -3,7 +3,9 @@ import { expect } from 'chai';
33import {
44 connect ,
55 Connection ,
6+ ConnectionOptions ,
67 LEGACY_HELLO_COMMAND ,
8+ makeClientMetadata ,
79 MongoClient ,
810 MongoServerError ,
911 ns ,
@@ -31,12 +33,13 @@ describe('Connection', function () {
3133 it ( 'should execute a command against a server' , {
3234 metadata : { requires : { apiVersion : false , topology : '!load-balanced' } } ,
3335 test : function ( done ) {
34- const connectOptions = Object . assign (
35- { connectionType : Connection } ,
36- this . configuration . options
37- ) ;
36+ const connectOptions : Partial < ConnectionOptions > = {
37+ connectionType : Connection ,
38+ ...this . configuration . options ,
39+ metadata : makeClientMetadata ( { driverInfo : { } } )
40+ } ;
3841
39- connect ( connectOptions , ( err , conn ) => {
42+ connect ( connectOptions as any as ConnectionOptions , ( err , conn ) => {
4043 expect ( err ) . to . not . exist ;
4144 this . defer ( _done => conn . destroy ( _done ) ) ;
4245
@@ -53,12 +56,14 @@ describe('Connection', function () {
5356 it ( 'should emit command monitoring events' , {
5457 metadata : { requires : { apiVersion : false , topology : '!load-balanced' } } ,
5558 test : function ( done ) {
56- const connectOptions = Object . assign (
57- { connectionType : Connection , monitorCommands : true } ,
58- this . configuration . options
59- ) ;
60-
61- connect ( connectOptions , ( err , conn ) => {
59+ const connectOptions : Partial < ConnectionOptions > = {
60+ connectionType : Connection ,
61+ monitorCommands : true ,
62+ ...this . configuration . options ,
63+ metadata : makeClientMetadata ( { driverInfo : { } } )
64+ } ;
65+
66+ connect ( connectOptions as any as ConnectionOptions , ( err , conn ) => {
6267 expect ( err ) . to . not . exist ;
6368 this . defer ( _done => conn . destroy ( _done ) ) ;
6469
@@ -84,12 +89,13 @@ describe('Connection', function () {
8489 } ,
8590 test : function ( done ) {
8691 const namespace = ns ( `${ this . configuration . db } .$cmd` ) ;
87- const connectOptions = Object . assign (
88- { connectionType : Connection } ,
89- this . configuration . options
90- ) ;
92+ const connectOptions : Partial < ConnectionOptions > = {
93+ connectionType : Connection ,
94+ ...this . configuration . options ,
95+ metadata : makeClientMetadata ( { driverInfo : { } } )
96+ } ;
9197
92- connect ( connectOptions , ( err , conn ) => {
98+ connect ( connectOptions as any as ConnectionOptions , ( err , conn ) => {
9399 expect ( err ) . to . not . exist ;
94100 this . defer ( _done => conn . destroy ( _done ) ) ;
95101
0 commit comments