@@ -89,11 +89,11 @@ suite('Connection Controller Test Suite', function () {
89
89
const dataService = testConnectionController . getActiveDataService ( ) ;
90
90
91
91
expect ( succesfullyConnected ) . to . be . true ;
92
- expect ( testConnectionController . getSavedConnections ( ) . length ) . to . equal ( 1 ) ;
92
+ expect ( testConnectionController . getSavedConnections ( ) ) . to . have . lengthOf ( 1 ) ;
93
93
expect ( name ) . to . equal ( 'localhost:27088' ) ;
94
94
expect ( testConnectionController . isCurrentlyConnected ( ) ) . to . be . true ;
95
95
96
- expect ( dataService ) . to . not . equal ( null ) ;
96
+ expect ( dataService ) . to . not . be . null ;
97
97
} ) ;
98
98
99
99
test ( '"disconnect()" disconnects from the active connection' , async ( ) => {
@@ -121,9 +121,9 @@ suite('Connection Controller Test Suite', function () {
121
121
) ;
122
122
expect ( successfullyDisconnected ) . to . be . true ;
123
123
expect ( connectionsCount ) . to . equal ( 1 ) ;
124
- expect ( connnectionId ) . to . equal ( null ) ;
124
+ expect ( connnectionId ) . to . be . null ;
125
125
expect ( testConnectionController . isCurrentlyConnected ( ) ) . to . be . false ;
126
- expect ( dataService ) . to . equal ( null ) ;
126
+ expect ( dataService ) . to . be . null ;
127
127
} ) ;
128
128
129
129
test ( '"removeMongoDBConnection()" returns a reject promise when there is no active connection' , async ( ) => {
@@ -150,9 +150,9 @@ suite('Connection Controller Test Suite', function () {
150
150
} catch ( error ) {
151
151
const expectedError = 'Failed to connect' ;
152
152
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 ;
156
156
}
157
157
} ) ;
158
158
@@ -237,7 +237,7 @@ suite('Connection Controller Test Suite', function () {
237
237
test ( 'when there are no existing connections in the store and the connection controller loads connections' , async ( ) => {
238
238
await testConnectionController . loadSavedConnections ( ) ;
239
239
240
- expect ( testConnectionController . getSavedConnections ( ) . length ) . to . equal ( 0 ) ;
240
+ expect ( testConnectionController . getSavedConnections ( ) ) . to . have . lengthOf ( 0 ) ;
241
241
} ) ;
242
242
243
243
test ( 'clears connections when loading saved connections' , async ( ) => {
@@ -261,8 +261,8 @@ suite('Connection Controller Test Suite', function () {
261
261
262
262
await testConnectionController . loadSavedConnections ( ) ;
263
263
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 ;
266
266
} ) ;
267
267
268
268
test ( 'the connection model loads both global and workspace stored connection models' , async ( ) => {
@@ -295,7 +295,7 @@ suite('Connection Controller Test Suite', function () {
295
295
296
296
const connections = testConnectionController . _connections ;
297
297
298
- expect ( Object . keys ( connections ) . length ) . to . equal ( 4 ) ;
298
+ expect ( Object . keys ( connections ) ) . to . have . lengthOf ( 4 ) ;
299
299
expect ( connections [ Object . keys ( connections ) [ 0 ] ] . name ) . to . equal (
300
300
'localhost:27088'
301
301
) ;
@@ -319,7 +319,7 @@ suite('Connection Controller Test Suite', function () {
319
319
StorageLocation . GLOBAL
320
320
) ;
321
321
322
- expect ( Object . keys ( globalStoreConnections ) . length ) . to . equal ( 1 ) ;
322
+ expect ( Object . keys ( globalStoreConnections ) ) . to . have . lengthOf ( 1 ) ;
323
323
324
324
const id = Object . keys ( globalStoreConnections ) [ 0 ] ;
325
325
@@ -331,7 +331,7 @@ suite('Connection Controller Test Suite', function () {
331
331
StorageVariables . WORKSPACE_SAVED_CONNECTIONS
332
332
) ;
333
333
334
- expect ( workspaceStoreConnections ) . to . equal ( undefined ) ;
334
+ expect ( workspaceStoreConnections ) . to . be . undefined ;
335
335
} ) ;
336
336
337
337
test ( 'when a connection is added it is saved to the workspace store' , async ( ) => {
@@ -351,7 +351,7 @@ suite('Connection Controller Test Suite', function () {
351
351
StorageLocation . WORKSPACE
352
352
) ;
353
353
354
- expect ( Object . keys ( workspaceStoreConnections ) . length ) . to . equal ( 1 ) ;
354
+ expect ( Object . keys ( workspaceStoreConnections ) ) . to . have . lengthOf ( 1 ) ;
355
355
356
356
const id = Object . keys ( workspaceStoreConnections ) [ 0 ] ;
357
357
@@ -364,7 +364,7 @@ suite('Connection Controller Test Suite', function () {
364
364
StorageLocation . GLOBAL
365
365
) ;
366
366
367
- expect ( globalStoreConnections ) . to . equal ( undefined ) ;
367
+ expect ( globalStoreConnections ) . to . be . undefined ;
368
368
} ) ;
369
369
370
370
test ( 'a connection can be connected to by id' , async ( ) => {
@@ -402,17 +402,17 @@ suite('Connection Controller Test Suite', function () {
402
402
StorageLocation . WORKSPACE
403
403
) ;
404
404
405
- expect ( Object . keys ( workspaceStoreConnections ) . length ) . to . equal ( 1 ) ;
405
+ expect ( Object . keys ( workspaceStoreConnections ) ) . to . have . lengthOf ( 1 ) ;
406
406
407
407
await testConnectionController . disconnect ( ) ;
408
408
testConnectionController . clearAllConnections ( ) ;
409
409
410
- expect ( testConnectionController . getSavedConnections ( ) . length ) . to . equal ( 0 ) ;
410
+ expect ( testConnectionController . getSavedConnections ( ) ) . to . have . lengthOf ( 0 ) ;
411
411
412
412
// Activate (which will load the past connection).
413
413
await testConnectionController . loadSavedConnections ( ) ;
414
414
415
- expect ( testConnectionController . getSavedConnections ( ) . length ) . to . equal ( 1 ) ;
415
+ expect ( testConnectionController . getSavedConnections ( ) ) . to . have . lengthOf ( 1 ) ;
416
416
417
417
const id = testConnectionController . getSavedConnections ( ) [ 0 ] . id ;
418
418
@@ -435,7 +435,7 @@ suite('Connection Controller Test Suite', function () {
435
435
436
436
const activeConnectionId = testConnectionController . getActiveConnectionId ( ) ;
437
437
438
- expect ( activeConnectionId ) . to . not . equal ( null ) ;
438
+ expect ( activeConnectionId ) . to . not . be . null ;
439
439
440
440
const testDriverUrl =
441
441
testConnectionController . copyConnectionStringByConnectionId (
@@ -482,16 +482,16 @@ suite('Connection Controller Test Suite', function () {
482
482
}
483
483
) ;
484
484
485
- expect ( expectedUndefinedDeviceFlow ) . to . equal ( undefined ) ;
485
+ expect ( expectedUndefinedDeviceFlow ) . to . be . undefined ;
486
486
487
487
const oidcConnectionString = new ConnectionString ( TEST_DATABASE_URI ) ;
488
488
oidcConnectionString . searchParams . set ( 'authMechanism' , 'MONGODB-OIDC' ) ;
489
489
490
490
const expectedFunction = getNotifyDeviceFlowForConnectionAttempt ( {
491
491
connectionString : oidcConnectionString . toString ( ) ,
492
492
} ) ;
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 ;
495
495
496
496
(
497
497
expectedFunction as ( deviceFlowInformation : {
@@ -525,7 +525,7 @@ suite('Connection Controller Test Suite', function () {
525
525
StorageLocation . WORKSPACE
526
526
) ;
527
527
528
- expect ( Object . keys ( workspaceStoreConnections ) . length ) . to . equal ( 1 ) ;
528
+ expect ( Object . keys ( workspaceStoreConnections ) ) . to . have . lengthOf ( 1 ) ;
529
529
530
530
const connectionId =
531
531
testConnectionController . getActiveConnectionId ( ) || 'a' ;
@@ -538,7 +538,7 @@ suite('Connection Controller Test Suite', function () {
538
538
StorageLocation . WORKSPACE
539
539
) ;
540
540
541
- expect ( Object . keys ( postWorkspaceStoreConnections ) . length ) . to . equal ( 0 ) ;
541
+ expect ( Object . keys ( postWorkspaceStoreConnections ) ) . to . have . lengthOf ( 0 ) ;
542
542
} ) ;
543
543
544
544
test ( 'when a connection is removed it is also removed from global storage' , async ( ) => {
@@ -555,7 +555,7 @@ suite('Connection Controller Test Suite', function () {
555
555
StorageLocation . GLOBAL
556
556
) ;
557
557
558
- expect ( Object . keys ( globalStoreConnections ) . length ) . to . equal ( 1 ) ;
558
+ expect ( Object . keys ( globalStoreConnections ) ) . to . have . lengthOf ( 1 ) ;
559
559
560
560
const connectionId =
561
561
testConnectionController . getActiveConnectionId ( ) || 'a' ;
@@ -566,7 +566,7 @@ suite('Connection Controller Test Suite', function () {
566
566
StorageLocation . GLOBAL
567
567
) ;
568
568
569
- expect ( Object . keys ( postGlobalStoreConnections ) . length ) . to . equal ( 0 ) ;
569
+ expect ( Object . keys ( postGlobalStoreConnections ) ) . to . have . lengthOf ( 0 ) ;
570
570
} ) ;
571
571
572
572
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 () {
601
601
StorageLocation . WORKSPACE
602
602
) ;
603
603
604
- expect ( Object . keys ( workspaceStoreConnections ) . length ) . to . equal ( 1 ) ;
604
+ expect ( Object . keys ( workspaceStoreConnections ) ) . to . have . lengthOf ( 1 ) ;
605
605
606
606
const connectionId =
607
607
testConnectionController . getActiveConnectionId ( ) || 'zz' ;
@@ -620,12 +620,12 @@ suite('Connection Controller Test Suite', function () {
620
620
621
621
testConnectionController . clearAllConnections ( ) ;
622
622
623
- expect ( testConnectionController . getSavedConnections ( ) . length ) . to . equal ( 0 ) ;
623
+ expect ( testConnectionController . getSavedConnections ( ) ) . to . have . lengthOf ( 0 ) ;
624
624
625
625
// Activate (which will load the past connection).
626
626
await testConnectionController . loadSavedConnections ( ) ;
627
627
628
- expect ( testConnectionController . getSavedConnections ( ) . length ) . to . equal ( 1 ) ;
628
+ expect ( testConnectionController . getSavedConnections ( ) ) . to . have . lengthOf ( 1 ) ;
629
629
630
630
const id = testConnectionController . getSavedConnections ( ) [ 0 ] . id ;
631
631
const name = testConnectionController . _connections [ id || 'x' ] . name ;
@@ -650,7 +650,7 @@ suite('Connection Controller Test Suite', function () {
650
650
StorageLocation . WORKSPACE
651
651
) ;
652
652
653
- expect ( Object . keys ( workspaceStoreConnections ) . length ) . to . equal ( 1 ) ;
653
+ expect ( Object . keys ( workspaceStoreConnections ) ) . to . have . lengthOf ( 1 ) ;
654
654
655
655
const connectionId =
656
656
testConnectionController . getActiveConnectionId ( ) || 'zz' ;
@@ -671,12 +671,12 @@ suite('Connection Controller Test Suite', function () {
671
671
672
672
testConnectionController . clearAllConnections ( ) ;
673
673
674
- expect ( testConnectionController . getSavedConnections ( ) . length ) . to . equal ( 0 ) ;
674
+ expect ( testConnectionController . getSavedConnections ( ) ) . to . have . lengthOf ( 0 ) ;
675
675
676
676
// Activate (which will load the past connection).
677
677
await testConnectionController . loadSavedConnections ( ) ;
678
678
679
- expect ( testConnectionController . getSavedConnections ( ) . length ) . to . equal ( 1 ) ;
679
+ expect ( testConnectionController . getSavedConnections ( ) ) . to . have . lengthOf ( 1 ) ;
680
680
681
681
const id = testConnectionController . getSavedConnections ( ) [ 0 ] . id ;
682
682
const connectTimeoutMS = new ConnectionString (
@@ -732,7 +732,7 @@ suite('Connection Controller Test Suite', function () {
732
732
const connections = testConnectionController . _connections ;
733
733
const connectionIds = Object . keys ( connections ) ;
734
734
735
- expect ( connectionIds . length ) . to . equal ( 2 ) ;
735
+ expect ( connectionIds ) . to . have . lengthOf ( 2 ) ;
736
736
expect ( connections [ connectionIds [ 0 ] ] . name ) . to . equal ( 'localhost:27088' ) ;
737
737
expect ( connections [ connectionIds [ 1 ] ] . name ) . to . equal ( 'localhost:27088' ) ;
738
738
@@ -748,12 +748,12 @@ suite('Connection Controller Test Suite', function () {
748
748
749
749
await testConnectionController . loadSavedConnections ( ) ;
750
750
751
- expect ( connectionIds . length ) . to . equal ( 2 ) ;
751
+ expect ( connectionIds ) . to . have . lengthOf ( 2 ) ;
752
752
753
753
const connectionQuickPicks =
754
754
testConnectionController . getConnectionQuickPicks ( ) ;
755
755
756
- expect ( connectionQuickPicks . length ) . to . equal ( 3 ) ;
756
+ expect ( connectionQuickPicks ) . to . have . lengthOf ( 3 ) ;
757
757
expect ( connectionQuickPicks [ 0 ] . label ) . to . equal ( 'Add new connection' ) ;
758
758
expect ( connectionQuickPicks [ 1 ] . label ) . to . equal ( 'localhost:27088' ) ;
759
759
expect ( connectionQuickPicks [ 2 ] . label ) . to . equal ( 'Lynx' ) ;
@@ -915,7 +915,7 @@ suite('Connection Controller Test Suite', function () {
915
915
await testConnectionController . loadSavedConnections ( ) ;
916
916
917
917
const connections = testConnectionController . getSavedConnections ( ) ;
918
- expect ( connections . length ) . to . equal ( 1 ) ;
918
+ expect ( connections ) . to . have . lengthOf ( 1 ) ;
919
919
920
920
const newSavedConnectionInfoWithSecrets =
921
921
await testConnectionController . _connectionStorage . _getConnectionInfoWithSecrets (
@@ -944,7 +944,7 @@ suite('Connection Controller Test Suite', function () {
944
944
expect ( workspaceStoreConnections ) . to . not . be . empty ;
945
945
const connections = Object . values ( workspaceStoreConnections ) ;
946
946
947
- expect ( connections . length ) . to . equal ( 1 ) ;
947
+ expect ( connections ) . to . have . lengthOf ( 1 ) ;
948
948
expect ( connections [ 0 ] . connectionOptions ?. connectionString ) . to . include (
949
949
TEST_USER_USERNAME
950
950
) ;
@@ -971,7 +971,7 @@ suite('Connection Controller Test Suite', function () {
971
971
const mongoClientConnectionOptions =
972
972
testConnectionController . getMongoClientConnectionOptions ( ) ;
973
973
974
- expect ( mongoClientConnectionOptions ) . to . not . equal ( undefined ) ;
974
+ expect ( mongoClientConnectionOptions ) . to . not . be . undefined ;
975
975
976
976
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
977
977
delete mongoClientConnectionOptions ! . options . parentHandle ;
0 commit comments