@@ -786,6 +786,36 @@ describe('ConnectionStorage', function () {
786
786
expect ( JSON . parse ( content ) . connectionInfo . id ) . to . be . equal ( id ) ;
787
787
} ) ;
788
788
789
+ it ( 'saves a connection with all ConnectionOptions set' , async function ( ) {
790
+ const id = new UUID ( ) . toString ( ) ;
791
+ const connectionOptions : Required < ConnectionInfo [ 'connectionOptions' ] > = {
792
+ connectionString : 'mongodb://localhost:27017/' ,
793
+ sshTunnel : { host : 'localhost' , port : 2222 , username : 'foobar' } ,
794
+ useApplicationLevelProxy : true ,
795
+ oidc : { } ,
796
+ fleOptions : { storeCredentials : false } ,
797
+ lookup : ( ) => ( { } as any ) ,
798
+ } ;
799
+ await connectionStorage . save ( {
800
+ connectionInfo : {
801
+ id,
802
+ connectionOptions,
803
+ } ,
804
+ } ) ;
805
+ delete ( connectionOptions as any ) . lookup ; // intentionally not stored
806
+
807
+ const content = await fs . readFile (
808
+ getConnectionFilePath ( tmpDir , id ) ,
809
+ 'utf-8'
810
+ ) ;
811
+ expect (
812
+ JSON . parse ( content ) . connectionInfo . connectionOptions
813
+ ) . to . deep . equal ( connectionOptions ) ;
814
+ expect (
815
+ ( await connectionStorage . load ( { id } ) ) ?. connectionOptions
816
+ ) . to . deep . equal ( connectionOptions ) ;
817
+ } ) ;
818
+
789
819
it ( 'saves a connection with arbitrary authMechanism' , async function ( ) {
790
820
const id = new UUID ( ) . toString ( ) ;
791
821
await connectionStorage . save ( {
0 commit comments