@@ -88,7 +88,7 @@ describe('StateMachine', function () {
88
88
timeoutMS : undefined
89
89
} ;
90
90
const serializedCommand = serialize ( command ) ;
91
- const stateMachine = new StateMachine ( { } as any ) ;
91
+ const stateMachine = new StateMachine ( { } as any , { } as any ) ;
92
92
93
93
context ( 'when executing the command' , function ( ) {
94
94
it ( 'does not promote values' , function ( ) {
@@ -132,7 +132,7 @@ describe('StateMachine', function () {
132
132
} ) ;
133
133
134
134
it ( 'should only resolve once bytesNeeded drops to zero' , function ( done ) {
135
- const stateMachine = new StateMachine ( { } as any ) ;
135
+ const stateMachine = new StateMachine ( { } as any , { } as any ) ;
136
136
const request = new MockRequest ( Buffer . from ( 'foobar' ) , 500 ) ;
137
137
let status = 'pending' ;
138
138
stateMachine
@@ -165,9 +165,12 @@ describe('StateMachine', function () {
165
165
} ) ;
166
166
167
167
context ( 'when socket options are provided' , function ( ) {
168
- const stateMachine = new StateMachine ( {
169
- socketOptions : { autoSelectFamily : true , autoSelectFamilyAttemptTimeout : 300 }
170
- } as any ) ;
168
+ const stateMachine = new StateMachine (
169
+ { } as any ,
170
+ {
171
+ socketOptions : { autoSelectFamily : true , autoSelectFamilyAttemptTimeout : 300 }
172
+ } as any
173
+ ) ;
171
174
const request = new MockRequest ( Buffer . from ( 'foobar' ) , - 1 ) ;
172
175
let connectOptions ;
173
176
@@ -198,9 +201,12 @@ describe('StateMachine', function () {
198
201
'tlsDisableCertificateRevocationCheck'
199
202
] . forEach ( function ( option ) {
200
203
context ( `when the option is ${ option } ` , function ( ) {
201
- const stateMachine = new StateMachine ( {
202
- tlsOptions : { aws : { [ option ] : true } }
203
- } as any ) ;
204
+ const stateMachine = new StateMachine (
205
+ { } as any ,
206
+ {
207
+ tlsOptions : { aws : { [ option ] : true } }
208
+ } as any
209
+ ) ;
204
210
const request = new MockRequest ( Buffer . from ( 'foobar' ) , 500 ) ;
205
211
206
212
it ( 'rejects with the validation error' , function ( done ) {
@@ -215,9 +221,12 @@ describe('StateMachine', function () {
215
221
216
222
context ( 'when the options are secure' , function ( ) {
217
223
context ( 'when providing tlsCertificateKeyFile' , function ( ) {
218
- const stateMachine = new StateMachine ( {
219
- tlsOptions : { aws : { tlsCertificateKeyFile : 'test.pem' } }
220
- } as any ) ;
224
+ const stateMachine = new StateMachine (
225
+ { } as any ,
226
+ {
227
+ tlsOptions : { aws : { tlsCertificateKeyFile : 'test.pem' } }
228
+ } as any
229
+ ) ;
221
230
const request = new MockRequest ( Buffer . from ( 'foobar' ) , - 1 ) ;
222
231
const buffer = Buffer . from ( 'foobar' ) ;
223
232
let connectOptions ;
@@ -244,9 +253,12 @@ describe('StateMachine', function () {
244
253
} ) ;
245
254
246
255
context ( 'when providing tlsCAFile' , function ( ) {
247
- const stateMachine = new StateMachine ( {
248
- tlsOptions : { aws : { tlsCAFile : 'test.pem' } }
249
- } as any ) ;
256
+ const stateMachine = new StateMachine (
257
+ { } as any ,
258
+ {
259
+ tlsOptions : { aws : { tlsCAFile : 'test.pem' } }
260
+ } as any
261
+ ) ;
250
262
const request = new MockRequest ( Buffer . from ( 'foobar' ) , - 1 ) ;
251
263
const buffer = Buffer . from ( 'foobar' ) ;
252
264
let connectOptions ;
@@ -272,9 +284,12 @@ describe('StateMachine', function () {
272
284
} ) ;
273
285
274
286
context ( 'when providing tlsCertificateKeyFilePassword' , function ( ) {
275
- const stateMachine = new StateMachine ( {
276
- tlsOptions : { aws : { tlsCertificateKeyFilePassword : 'test' } }
277
- } as any ) ;
287
+ const stateMachine = new StateMachine (
288
+ { } as any ,
289
+ {
290
+ tlsOptions : { aws : { tlsCertificateKeyFilePassword : 'test' } }
291
+ } as any
292
+ ) ;
278
293
const request = new MockRequest ( Buffer . from ( 'foobar' ) , - 1 ) ;
279
294
let connectOptions ;
280
295
@@ -313,12 +328,15 @@ describe('StateMachine', function () {
313
328
} ) ;
314
329
315
330
it ( 'throws a MongoCryptError with SocksClientError cause' , async function ( ) {
316
- const stateMachine = new StateMachine ( {
317
- proxyOptions : {
318
- proxyHost : 'localhost' ,
319
- proxyPort : server . address ( ) . port
320
- }
321
- } as any ) ;
331
+ const stateMachine = new StateMachine (
332
+ { } as any ,
333
+ {
334
+ proxyOptions : {
335
+ proxyHost : 'localhost' ,
336
+ proxyPort : server . address ( ) . port
337
+ }
338
+ } as any
339
+ ) ;
322
340
const request = new MockRequest ( Buffer . from ( 'foobar' ) , 500 ) ;
323
341
324
342
try {
@@ -363,10 +381,13 @@ describe('StateMachine', function () {
363
381
} ) ;
364
382
365
383
it ( 'throws a MongoCryptError error' , async function ( ) {
366
- const stateMachine = new StateMachine ( {
367
- host : 'localhost' ,
368
- port : server . address ( ) . port
369
- } as any ) ;
384
+ const stateMachine = new StateMachine (
385
+ { } as any ,
386
+ {
387
+ host : 'localhost' ,
388
+ port : server . address ( ) . port
389
+ } as any
390
+ ) ;
370
391
const request = new MockRequest ( Buffer . from ( 'foobar' ) , 500 ) ;
371
392
372
393
try {
@@ -432,12 +453,15 @@ describe('StateMachine', function () {
432
453
} ) ;
433
454
434
455
it ( 'should create HTTPS connections through a Socks5 proxy (no proxy auth)' , async function ( ) {
435
- const stateMachine = new StateMachine ( {
436
- proxyOptions : {
437
- proxyHost : 'localhost' ,
438
- proxyPort : socks5srv . address ( ) . port
439
- }
440
- } as any ) ;
456
+ const stateMachine = new StateMachine (
457
+ { } as any ,
458
+ {
459
+ proxyOptions : {
460
+ proxyHost : 'localhost' ,
461
+ proxyPort : socks5srv . address ( ) . port
462
+ }
463
+ } as any
464
+ ) ;
441
465
442
466
const request = new MockRequest ( Buffer . from ( 'foobar' ) , 500 ) ;
443
467
try {
@@ -453,14 +477,17 @@ describe('StateMachine', function () {
453
477
454
478
it ( 'should create HTTPS connections through a Socks5 proxy (username/password auth)' , async function ( ) {
455
479
withUsernamePassword = true ;
456
- const stateMachine = new StateMachine ( {
457
- proxyOptions : {
458
- proxyHost : 'localhost' ,
459
- proxyPort : socks5srv . address ( ) . port ,
460
- proxyUsername : 'foo' ,
461
- proxyPassword : 'bar'
462
- }
463
- } as any ) ;
480
+ const stateMachine = new StateMachine (
481
+ { } as any ,
482
+ {
483
+ proxyOptions : {
484
+ proxyHost : 'localhost' ,
485
+ proxyPort : socks5srv . address ( ) . port ,
486
+ proxyUsername : 'foo' ,
487
+ proxyPassword : 'bar'
488
+ }
489
+ } as any
490
+ ) ;
464
491
465
492
const request = new MockRequest ( Buffer . from ( 'foobar' ) , 500 ) ;
466
493
try {
@@ -477,7 +504,7 @@ describe('StateMachine', function () {
477
504
478
505
describe ( 'CSOT' , function ( ) {
479
506
describe ( '#fetchKeys' , function ( ) {
480
- const stateMachine = new StateMachine ( { } as any ) ;
507
+ const stateMachine = new StateMachine ( { } as any , { } as any ) ;
481
508
const client = new MongoClient ( 'mongodb://localhost:27017' ) ;
482
509
let findSpy ;
483
510
@@ -519,7 +546,7 @@ describe('StateMachine', function () {
519
546
} ) ;
520
547
521
548
describe ( '#markCommand' , function ( ) {
522
- const stateMachine = new StateMachine ( { } as any ) ;
549
+ const stateMachine = new StateMachine ( { } as any , { } as any ) ;
523
550
const client = new MongoClient ( 'mongodb://localhost:27017' ) ;
524
551
let dbCommandSpy ;
525
552
@@ -558,7 +585,7 @@ describe('StateMachine', function () {
558
585
} ) ;
559
586
560
587
describe ( '#fetchCollectionInfo' , function ( ) {
561
- const stateMachine = new StateMachine ( { } as any ) ;
588
+ const stateMachine = new StateMachine ( { } as any , { } as any ) ;
562
589
const client = new MongoClient ( 'mongodb://localhost:27017' ) ;
563
590
let listCollectionsSpy ;
564
591
0 commit comments