@@ -3,7 +3,9 @@ import { expect } from 'chai';
3
3
import {
4
4
connect ,
5
5
Connection ,
6
+ ConnectionOptions ,
6
7
LEGACY_HELLO_COMMAND ,
8
+ makeClientMetadata ,
7
9
MongoClient ,
8
10
MongoServerError ,
9
11
ns ,
@@ -31,12 +33,13 @@ describe('Connection', function () {
31
33
it ( 'should execute a command against a server' , {
32
34
metadata : { requires : { apiVersion : false , topology : '!load-balanced' } } ,
33
35
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
+ } ;
38
41
39
- connect ( connectOptions , ( err , conn ) => {
42
+ connect ( connectOptions as any as ConnectionOptions , ( err , conn ) => {
40
43
expect ( err ) . to . not . exist ;
41
44
this . defer ( _done => conn . destroy ( _done ) ) ;
42
45
@@ -53,12 +56,14 @@ describe('Connection', function () {
53
56
it ( 'should emit command monitoring events' , {
54
57
metadata : { requires : { apiVersion : false , topology : '!load-balanced' } } ,
55
58
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 ) => {
62
67
expect ( err ) . to . not . exist ;
63
68
this . defer ( _done => conn . destroy ( _done ) ) ;
64
69
@@ -84,12 +89,13 @@ describe('Connection', function () {
84
89
} ,
85
90
test : function ( done ) {
86
91
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
+ } ;
91
97
92
- connect ( connectOptions , ( err , conn ) => {
98
+ connect ( connectOptions as any as ConnectionOptions , ( err , conn ) => {
93
99
expect ( err ) . to . not . exist ;
94
100
this . defer ( _done => conn . destroy ( _done ) ) ;
95
101
0 commit comments