|
6 | 6 | getFAASEnv, |
7 | 7 | Int32, |
8 | 8 | LEGACY_HELLO_COMMAND, |
| 9 | + MongoDBResponse, |
9 | 10 | type MongoClient |
10 | 11 | } from '../../mongodb'; |
11 | 12 | import { sleep } from '../../tools/utils'; |
@@ -239,19 +240,21 @@ describe('Client Metadata Update Prose Tests', function () { |
239 | 240 | } |
240 | 241 | ); |
241 | 242 |
|
242 | | - sinon.stub(Connection.prototype, 'command').callsFake(async function (ns, cmd, options) { |
243 | | - // @ts-expect-error: sinon will place wrappedMethod on the command method. |
244 | | - const command = Connection.prototype.command.wrappedMethod.bind(this); |
245 | | - |
246 | | - if (cmd.hello || cmd[LEGACY_HELLO_COMMAND]) { |
247 | | - if (!initialClientMetadata) { |
248 | | - initialClientMetadata = cmd.client; |
249 | | - } else { |
250 | | - updatedClientMetadata = cmd.client; |
| 243 | + sinon |
| 244 | + .stub(Connection.prototype, 'command') |
| 245 | + .callsFake(async function (ns, cmd, options, responseType) { |
| 246 | + // @ts-expect-error: sinon will place wrappedMethod on the command method. |
| 247 | + const command = Connection.prototype.command.wrappedMethod.bind(this); |
| 248 | + |
| 249 | + if (cmd.hello || cmd[LEGACY_HELLO_COMMAND]) { |
| 250 | + if (!initialClientMetadata) { |
| 251 | + initialClientMetadata = cmd.client; |
| 252 | + } else { |
| 253 | + updatedClientMetadata = cmd.client; |
| 254 | + } |
251 | 255 | } |
252 | | - } |
253 | | - return command(ns, cmd, options); |
254 | | - }); |
| 256 | + return command(ns, cmd, options, responseType); |
| 257 | + }); |
255 | 258 |
|
256 | 259 | await client.db('test').command({ ping: 1 }); |
257 | 260 | await sleep(5); |
@@ -311,19 +314,21 @@ describe('Client Metadata Update Prose Tests', function () { |
311 | 314 | client = this.configuration.newClient({}, { maxIdleTimeMS: 1 }); |
312 | 315 | client.appendMetadata({ name: 'library', version: '1.2', platform: 'Library Platform' }); |
313 | 316 |
|
314 | | - sinon.stub(Connection.prototype, 'command').callsFake(async function (ns, cmd, options) { |
315 | | - // @ts-expect-error: sinon will place wrappedMethod on the command method. |
316 | | - const command = Connection.prototype.command.wrappedMethod.bind(this); |
317 | | - |
318 | | - if (cmd.hello || cmd[LEGACY_HELLO_COMMAND]) { |
319 | | - if (!initialClientMetadata) { |
320 | | - initialClientMetadata = cmd.client; |
321 | | - } else { |
322 | | - updatedClientMetadata = cmd.client; |
| 317 | + sinon |
| 318 | + .stub(Connection.prototype, 'command') |
| 319 | + .callsFake(async function (ns, cmd, options, responseType) { |
| 320 | + // @ts-expect-error: sinon will place wrappedMethod on the command method. |
| 321 | + const command = Connection.prototype.command.wrappedMethod.bind(this); |
| 322 | + |
| 323 | + if (cmd.hello || cmd[LEGACY_HELLO_COMMAND]) { |
| 324 | + if (!initialClientMetadata) { |
| 325 | + initialClientMetadata = cmd.client; |
| 326 | + } else { |
| 327 | + updatedClientMetadata = cmd.client; |
| 328 | + } |
323 | 329 | } |
324 | | - } |
325 | | - return command(ns, cmd, options); |
326 | | - }); |
| 330 | + return command(ns, cmd, options, responseType); |
| 331 | + }); |
327 | 332 |
|
328 | 333 | await client.db('test').command({ ping: 1 }); |
329 | 334 | await sleep(5); |
|
0 commit comments