Skip to content

Commit e27e4e5

Browse files
committed
chore: fix ctor usages
1 parent b5e73c0 commit e27e4e5

File tree

4 files changed

+74
-47
lines changed

4 files changed

+74
-47
lines changed

Diff for: test/integration/client-side-encryption/driver.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ describe('CSOT', function () {
791791
});
792792

793793
describe('State machine', function () {
794-
const stateMachine = new StateMachine({} as any);
794+
const stateMachine = new StateMachine({} as any, {} as any);
795795

796796
const timeoutContext = () => ({
797797
timeoutContext: new CSOTTimeoutContext({

Diff for: test/integration/client-side-operations-timeout/client_side_operations_timeout.unit.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe('CSOT spec unit tests', function () {
111111

112112
describe('Client side encryption', function () {
113113
describe('KMS requests', function () {
114-
const stateMachine = new StateMachine({} as any);
114+
const stateMachine = new StateMachine({} as any, {} as any);
115115
const request = {
116116
addResponse: _response => {},
117117
status: {

Diff for: test/integration/node-specific/abort_signal.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ describe('AbortSignal support', () => {
817817
});
818818

819819
describe('KMS requests', function () {
820-
const stateMachine = new StateMachine({} as any);
820+
const stateMachine = new StateMachine({} as any, {} as any);
821821
const request = {
822822
addResponse: _response => undefined,
823823
status: {

Diff for: test/unit/client-side-encryption/state_machine.test.ts

+71-44
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe('StateMachine', function () {
8888
timeoutMS: undefined
8989
};
9090
const serializedCommand = serialize(command);
91-
const stateMachine = new StateMachine({} as any);
91+
const stateMachine = new StateMachine({} as any, {} as any);
9292

9393
context('when executing the command', function () {
9494
it('does not promote values', function () {
@@ -132,7 +132,7 @@ describe('StateMachine', function () {
132132
});
133133

134134
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);
136136
const request = new MockRequest(Buffer.from('foobar'), 500);
137137
let status = 'pending';
138138
stateMachine
@@ -165,9 +165,12 @@ describe('StateMachine', function () {
165165
});
166166

167167
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+
);
171174
const request = new MockRequest(Buffer.from('foobar'), -1);
172175
let connectOptions;
173176

@@ -198,9 +201,12 @@ describe('StateMachine', function () {
198201
'tlsDisableCertificateRevocationCheck'
199202
].forEach(function (option) {
200203
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+
);
204210
const request = new MockRequest(Buffer.from('foobar'), 500);
205211

206212
it('rejects with the validation error', function (done) {
@@ -215,9 +221,12 @@ describe('StateMachine', function () {
215221

216222
context('when the options are secure', function () {
217223
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+
);
221230
const request = new MockRequest(Buffer.from('foobar'), -1);
222231
const buffer = Buffer.from('foobar');
223232
let connectOptions;
@@ -244,9 +253,12 @@ describe('StateMachine', function () {
244253
});
245254

246255
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+
);
250262
const request = new MockRequest(Buffer.from('foobar'), -1);
251263
const buffer = Buffer.from('foobar');
252264
let connectOptions;
@@ -272,9 +284,12 @@ describe('StateMachine', function () {
272284
});
273285

274286
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+
);
278293
const request = new MockRequest(Buffer.from('foobar'), -1);
279294
let connectOptions;
280295

@@ -313,12 +328,15 @@ describe('StateMachine', function () {
313328
});
314329

315330
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+
);
322340
const request = new MockRequest(Buffer.from('foobar'), 500);
323341

324342
try {
@@ -363,10 +381,13 @@ describe('StateMachine', function () {
363381
});
364382

365383
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+
);
370391
const request = new MockRequest(Buffer.from('foobar'), 500);
371392

372393
try {
@@ -432,12 +453,15 @@ describe('StateMachine', function () {
432453
});
433454

434455
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+
);
441465

442466
const request = new MockRequest(Buffer.from('foobar'), 500);
443467
try {
@@ -453,14 +477,17 @@ describe('StateMachine', function () {
453477

454478
it('should create HTTPS connections through a Socks5 proxy (username/password auth)', async function () {
455479
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+
);
464491

465492
const request = new MockRequest(Buffer.from('foobar'), 500);
466493
try {
@@ -477,7 +504,7 @@ describe('StateMachine', function () {
477504

478505
describe('CSOT', function () {
479506
describe('#fetchKeys', function () {
480-
const stateMachine = new StateMachine({} as any);
507+
const stateMachine = new StateMachine({} as any, {} as any);
481508
const client = new MongoClient('mongodb://localhost:27017');
482509
let findSpy;
483510

@@ -519,7 +546,7 @@ describe('StateMachine', function () {
519546
});
520547

521548
describe('#markCommand', function () {
522-
const stateMachine = new StateMachine({} as any);
549+
const stateMachine = new StateMachine({} as any, {} as any);
523550
const client = new MongoClient('mongodb://localhost:27017');
524551
let dbCommandSpy;
525552

@@ -558,7 +585,7 @@ describe('StateMachine', function () {
558585
});
559586

560587
describe('#fetchCollectionInfo', function () {
561-
const stateMachine = new StateMachine({} as any);
588+
const stateMachine = new StateMachine({} as any, {} as any);
562589
const client = new MongoClient('mongodb://localhost:27017');
563590
let listCollectionsSpy;
564591

0 commit comments

Comments
 (0)