@@ -5,7 +5,7 @@ import { connect } from '../../../src/cmap/connect';
55import { Connection } from '../../../src/cmap/connection' ;
66import { LEGACY_HELLO_COMMAND } from '../../../src/constants' ;
77import { Topology } from '../../../src/sdam/topology' ;
8- import { ns } from '../../../src/utils' ;
8+ import { makeClientMetadata , ns } from '../../../src/utils' ;
99import { skipBrokenAuthTestBeforeEachHook } from '../../tools/runner/hooks/configuration' ;
1010import { assert as test , setupDatabase } from '../shared' ;
1111
@@ -27,12 +27,13 @@ describe('Connection', function () {
2727 it ( 'should execute a command against a server' , {
2828 metadata : { requires : { apiVersion : false , topology : '!load-balanced' } } ,
2929 test : function ( done ) {
30- const connectOptions = Object . assign (
31- { connectionType : Connection } ,
32- this . configuration . options
33- ) ;
30+ const connectOptions : Partial < ConnectionOptions > = {
31+ connectionType : Connection ,
32+ ...this . configuration . options ,
33+ metadata : makeClientMetadata ( { driverInfo : { } } )
34+ } ;
3435
35- connect ( connectOptions , ( err , conn ) => {
36+ connect ( connectOptions as any as ConnectionOptions , ( err , conn ) => {
3637 expect ( err ) . to . not . exist ;
3738 this . defer ( _done => conn . destroy ( _done ) ) ;
3839
@@ -49,12 +50,14 @@ describe('Connection', function () {
4950 it ( 'should emit command monitoring events' , {
5051 metadata : { requires : { apiVersion : false , topology : '!load-balanced' } } ,
5152 test : function ( done ) {
52- const connectOptions = Object . assign (
53- { connectionType : Connection , monitorCommands : true } ,
54- this . configuration . options
55- ) ;
56-
57- connect ( connectOptions , ( err , conn ) => {
53+ const connectOptions : Partial < ConnectionOptions > = {
54+ connectionType : Connection ,
55+ monitorCommands : true ,
56+ ...this . configuration . options ,
57+ metadata : makeClientMetadata ( { driverInfo : { } } )
58+ } ;
59+
60+ connect ( connectOptions as any as ConnectionOptions , ( err , conn ) => {
5861 expect ( err ) . to . not . exist ;
5962 this . defer ( _done => conn . destroy ( _done ) ) ;
6063
@@ -80,12 +83,13 @@ describe('Connection', function () {
8083 } ,
8184 test : function ( done ) {
8285 const namespace = ns ( `${ this . configuration . db } .$cmd` ) ;
83- const connectOptions = Object . assign (
84- { connectionType : Connection } ,
85- this . configuration . options
86- ) ;
86+ const connectOptions : Partial < ConnectionOptions > = {
87+ connectionType : Connection ,
88+ ...this . configuration . options ,
89+ metadata : makeClientMetadata ( { driverInfo : { } } )
90+ } ;
8791
88- connect ( connectOptions , ( err , conn ) => {
92+ connect ( connectOptions as any as ConnectionOptions , ( err , conn ) => {
8993 expect ( err ) . to . not . exist ;
9094 this . defer ( _done => conn . destroy ( _done ) ) ;
9195
0 commit comments