Skip to content

Commit 101d9e2

Browse files
authored
chore(deps): bump oidc-plugin MONGOSH-2027 (#971)
1 parent 077e09a commit 101d9e2

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

src/test/suite/connectionController.test.ts

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ suite('Connection Controller Test Suite', function () {
8989
const dataService = testConnectionController.getActiveDataService();
9090

9191
expect(succesfullyConnected).to.be.true;
92-
expect(testConnectionController.getSavedConnections().length).to.equal(1);
92+
expect(testConnectionController.getSavedConnections()).to.have.lengthOf(1);
9393
expect(name).to.equal('localhost:27088');
9494
expect(testConnectionController.isCurrentlyConnected()).to.be.true;
9595

96-
expect(dataService).to.not.equal(null);
96+
expect(dataService).to.not.be.null;
9797
});
9898

9999
test('"disconnect()" disconnects from the active connection', async () => {
@@ -121,9 +121,9 @@ suite('Connection Controller Test Suite', function () {
121121
);
122122
expect(successfullyDisconnected).to.be.true;
123123
expect(connectionsCount).to.equal(1);
124-
expect(connnectionId).to.equal(null);
124+
expect(connnectionId).to.be.null;
125125
expect(testConnectionController.isCurrentlyConnected()).to.be.false;
126-
expect(dataService).to.equal(null);
126+
expect(dataService).to.be.null;
127127
});
128128

129129
test('"removeMongoDBConnection()" returns a reject promise when there is no active connection', async () => {
@@ -150,9 +150,9 @@ suite('Connection Controller Test Suite', function () {
150150
} catch (error) {
151151
const expectedError = 'Failed to connect';
152152

153-
expect(formatError(error).message.includes(expectedError)).to.be.true;
154-
expect(testConnectionController.getActiveDataService()).to.equal(null);
155-
expect(testConnectionController.getActiveConnectionId()).to.equal(null);
153+
expect(formatError(error).message).includes(expectedError);
154+
expect(testConnectionController.getActiveDataService()).to.be.null;
155+
expect(testConnectionController.getActiveConnectionId()).to.be.null;
156156
}
157157
});
158158

@@ -237,7 +237,7 @@ suite('Connection Controller Test Suite', function () {
237237
test('when there are no existing connections in the store and the connection controller loads connections', async () => {
238238
await testConnectionController.loadSavedConnections();
239239

240-
expect(testConnectionController.getSavedConnections().length).to.equal(0);
240+
expect(testConnectionController.getSavedConnections()).to.have.lengthOf(0);
241241
});
242242

243243
test('clears connections when loading saved connections', async () => {
@@ -261,8 +261,8 @@ suite('Connection Controller Test Suite', function () {
261261

262262
await testConnectionController.loadSavedConnections();
263263

264-
expect(testConnectionController.getSavedConnections().length).to.equal(1);
265-
expect(testConnectionController._connections['1234']).is.undefined;
264+
expect(testConnectionController.getSavedConnections()).to.have.lengthOf(1);
265+
expect(testConnectionController._connections['1234']).to.be.undefined;
266266
});
267267

268268
test('the connection model loads both global and workspace stored connection models', async () => {
@@ -295,7 +295,7 @@ suite('Connection Controller Test Suite', function () {
295295

296296
const connections = testConnectionController._connections;
297297

298-
expect(Object.keys(connections).length).to.equal(4);
298+
expect(Object.keys(connections)).to.have.lengthOf(4);
299299
expect(connections[Object.keys(connections)[0]].name).to.equal(
300300
'localhost:27088'
301301
);
@@ -319,7 +319,7 @@ suite('Connection Controller Test Suite', function () {
319319
StorageLocation.GLOBAL
320320
);
321321

322-
expect(Object.keys(globalStoreConnections).length).to.equal(1);
322+
expect(Object.keys(globalStoreConnections)).to.have.lengthOf(1);
323323

324324
const id = Object.keys(globalStoreConnections)[0];
325325

@@ -331,7 +331,7 @@ suite('Connection Controller Test Suite', function () {
331331
StorageVariables.WORKSPACE_SAVED_CONNECTIONS
332332
);
333333

334-
expect(workspaceStoreConnections).to.equal(undefined);
334+
expect(workspaceStoreConnections).to.be.undefined;
335335
});
336336

337337
test('when a connection is added it is saved to the workspace store', async () => {
@@ -351,7 +351,7 @@ suite('Connection Controller Test Suite', function () {
351351
StorageLocation.WORKSPACE
352352
);
353353

354-
expect(Object.keys(workspaceStoreConnections).length).to.equal(1);
354+
expect(Object.keys(workspaceStoreConnections)).to.have.lengthOf(1);
355355

356356
const id = Object.keys(workspaceStoreConnections)[0];
357357

@@ -364,7 +364,7 @@ suite('Connection Controller Test Suite', function () {
364364
StorageLocation.GLOBAL
365365
);
366366

367-
expect(globalStoreConnections).to.equal(undefined);
367+
expect(globalStoreConnections).to.be.undefined;
368368
});
369369

370370
test('a connection can be connected to by id', async () => {
@@ -402,17 +402,17 @@ suite('Connection Controller Test Suite', function () {
402402
StorageLocation.WORKSPACE
403403
);
404404

405-
expect(Object.keys(workspaceStoreConnections).length).to.equal(1);
405+
expect(Object.keys(workspaceStoreConnections)).to.have.lengthOf(1);
406406

407407
await testConnectionController.disconnect();
408408
testConnectionController.clearAllConnections();
409409

410-
expect(testConnectionController.getSavedConnections().length).to.equal(0);
410+
expect(testConnectionController.getSavedConnections()).to.have.lengthOf(0);
411411

412412
// Activate (which will load the past connection).
413413
await testConnectionController.loadSavedConnections();
414414

415-
expect(testConnectionController.getSavedConnections().length).to.equal(1);
415+
expect(testConnectionController.getSavedConnections()).to.have.lengthOf(1);
416416

417417
const id = testConnectionController.getSavedConnections()[0].id;
418418

@@ -435,7 +435,7 @@ suite('Connection Controller Test Suite', function () {
435435

436436
const activeConnectionId = testConnectionController.getActiveConnectionId();
437437

438-
expect(activeConnectionId).to.not.equal(null);
438+
expect(activeConnectionId).to.not.be.null;
439439

440440
const testDriverUrl =
441441
testConnectionController.copyConnectionStringByConnectionId(
@@ -482,16 +482,16 @@ suite('Connection Controller Test Suite', function () {
482482
}
483483
);
484484

485-
expect(expectedUndefinedDeviceFlow).to.equal(undefined);
485+
expect(expectedUndefinedDeviceFlow).to.be.undefined;
486486

487487
const oidcConnectionString = new ConnectionString(TEST_DATABASE_URI);
488488
oidcConnectionString.searchParams.set('authMechanism', 'MONGODB-OIDC');
489489

490490
const expectedFunction = getNotifyDeviceFlowForConnectionAttempt({
491491
connectionString: oidcConnectionString.toString(),
492492
});
493-
expect(expectedFunction).to.not.equal(undefined);
494-
expect(showInformationMessageStub.called).to.equal(false);
493+
expect(expectedFunction).to.not.be.undefined;
494+
expect(showInformationMessageStub.called).to.be.false;
495495

496496
(
497497
expectedFunction as (deviceFlowInformation: {
@@ -525,7 +525,7 @@ suite('Connection Controller Test Suite', function () {
525525
StorageLocation.WORKSPACE
526526
);
527527

528-
expect(Object.keys(workspaceStoreConnections).length).to.equal(1);
528+
expect(Object.keys(workspaceStoreConnections)).to.have.lengthOf(1);
529529

530530
const connectionId =
531531
testConnectionController.getActiveConnectionId() || 'a';
@@ -538,7 +538,7 @@ suite('Connection Controller Test Suite', function () {
538538
StorageLocation.WORKSPACE
539539
);
540540

541-
expect(Object.keys(postWorkspaceStoreConnections).length).to.equal(0);
541+
expect(Object.keys(postWorkspaceStoreConnections)).to.have.lengthOf(0);
542542
});
543543

544544
test('when a connection is removed it is also removed from global storage', async () => {
@@ -555,7 +555,7 @@ suite('Connection Controller Test Suite', function () {
555555
StorageLocation.GLOBAL
556556
);
557557

558-
expect(Object.keys(globalStoreConnections).length).to.equal(1);
558+
expect(Object.keys(globalStoreConnections)).to.have.lengthOf(1);
559559

560560
const connectionId =
561561
testConnectionController.getActiveConnectionId() || 'a';
@@ -566,7 +566,7 @@ suite('Connection Controller Test Suite', function () {
566566
StorageLocation.GLOBAL
567567
);
568568

569-
expect(Object.keys(postGlobalStoreConnections).length).to.equal(0);
569+
expect(Object.keys(postGlobalStoreConnections)).to.have.lengthOf(0);
570570
});
571571

572572
test('when a connection is removed, the secrets for that connection are also removed', async () => {
@@ -601,7 +601,7 @@ suite('Connection Controller Test Suite', function () {
601601
StorageLocation.WORKSPACE
602602
);
603603

604-
expect(Object.keys(workspaceStoreConnections).length).to.equal(1);
604+
expect(Object.keys(workspaceStoreConnections)).to.have.lengthOf(1);
605605

606606
const connectionId =
607607
testConnectionController.getActiveConnectionId() || 'zz';
@@ -620,12 +620,12 @@ suite('Connection Controller Test Suite', function () {
620620

621621
testConnectionController.clearAllConnections();
622622

623-
expect(testConnectionController.getSavedConnections().length).to.equal(0);
623+
expect(testConnectionController.getSavedConnections()).to.have.lengthOf(0);
624624

625625
// Activate (which will load the past connection).
626626
await testConnectionController.loadSavedConnections();
627627

628-
expect(testConnectionController.getSavedConnections().length).to.equal(1);
628+
expect(testConnectionController.getSavedConnections()).to.have.lengthOf(1);
629629

630630
const id = testConnectionController.getSavedConnections()[0].id;
631631
const name = testConnectionController._connections[id || 'x'].name;
@@ -650,7 +650,7 @@ suite('Connection Controller Test Suite', function () {
650650
StorageLocation.WORKSPACE
651651
);
652652

653-
expect(Object.keys(workspaceStoreConnections).length).to.equal(1);
653+
expect(Object.keys(workspaceStoreConnections)).to.have.lengthOf(1);
654654

655655
const connectionId =
656656
testConnectionController.getActiveConnectionId() || 'zz';
@@ -671,12 +671,12 @@ suite('Connection Controller Test Suite', function () {
671671

672672
testConnectionController.clearAllConnections();
673673

674-
expect(testConnectionController.getSavedConnections().length).to.equal(0);
674+
expect(testConnectionController.getSavedConnections()).to.have.lengthOf(0);
675675

676676
// Activate (which will load the past connection).
677677
await testConnectionController.loadSavedConnections();
678678

679-
expect(testConnectionController.getSavedConnections().length).to.equal(1);
679+
expect(testConnectionController.getSavedConnections()).to.have.lengthOf(1);
680680

681681
const id = testConnectionController.getSavedConnections()[0].id;
682682
const connectTimeoutMS = new ConnectionString(
@@ -732,7 +732,7 @@ suite('Connection Controller Test Suite', function () {
732732
const connections = testConnectionController._connections;
733733
const connectionIds = Object.keys(connections);
734734

735-
expect(connectionIds.length).to.equal(2);
735+
expect(connectionIds).to.have.lengthOf(2);
736736
expect(connections[connectionIds[0]].name).to.equal('localhost:27088');
737737
expect(connections[connectionIds[1]].name).to.equal('localhost:27088');
738738

@@ -748,12 +748,12 @@ suite('Connection Controller Test Suite', function () {
748748

749749
await testConnectionController.loadSavedConnections();
750750

751-
expect(connectionIds.length).to.equal(2);
751+
expect(connectionIds).to.have.lengthOf(2);
752752

753753
const connectionQuickPicks =
754754
testConnectionController.getConnectionQuickPicks();
755755

756-
expect(connectionQuickPicks.length).to.equal(3);
756+
expect(connectionQuickPicks).to.have.lengthOf(3);
757757
expect(connectionQuickPicks[0].label).to.equal('Add new connection');
758758
expect(connectionQuickPicks[1].label).to.equal('localhost:27088');
759759
expect(connectionQuickPicks[2].label).to.equal('Lynx');
@@ -915,7 +915,7 @@ suite('Connection Controller Test Suite', function () {
915915
await testConnectionController.loadSavedConnections();
916916

917917
const connections = testConnectionController.getSavedConnections();
918-
expect(connections.length).to.equal(1);
918+
expect(connections).to.have.lengthOf(1);
919919

920920
const newSavedConnectionInfoWithSecrets =
921921
await testConnectionController._connectionStorage._getConnectionInfoWithSecrets(
@@ -944,7 +944,7 @@ suite('Connection Controller Test Suite', function () {
944944
expect(workspaceStoreConnections).to.not.be.empty;
945945
const connections = Object.values(workspaceStoreConnections);
946946

947-
expect(connections.length).to.equal(1);
947+
expect(connections).to.have.lengthOf(1);
948948
expect(connections[0].connectionOptions?.connectionString).to.include(
949949
TEST_USER_USERNAME
950950
);
@@ -971,7 +971,7 @@ suite('Connection Controller Test Suite', function () {
971971
const mongoClientConnectionOptions =
972972
testConnectionController.getMongoClientConnectionOptions();
973973

974-
expect(mongoClientConnectionOptions).to.not.equal(undefined);
974+
expect(mongoClientConnectionOptions).to.not.be.undefined;
975975

976976
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
977977
delete mongoClientConnectionOptions!.options.parentHandle;

0 commit comments

Comments
 (0)