Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,36 @@ describe('ConnectionStorage', function () {
expect(JSON.parse(content).connectionInfo.id).to.be.equal(id);
});

it('saves a connection with all ConnectionOptions set', async function () {
const id = new UUID().toString();
const connectionOptions: Required<ConnectionInfo['connectionOptions']> = {
connectionString: 'mongodb://localhost:27017/',
sshTunnel: { host: 'localhost', port: 2222, username: 'foobar' },
useApplicationLevelProxy: true,
oidc: {},
fleOptions: { storeCredentials: false },
lookup: () => ({} as any),
};
await connectionStorage.save({
connectionInfo: {
id,
connectionOptions,
},
});
delete (connectionOptions as any).lookup; // intentionally not stored

const content = await fs.readFile(
getConnectionFilePath(tmpDir, id),
'utf-8'
);
expect(
JSON.parse(content).connectionInfo.connectionOptions
).to.deep.equal(connectionOptions);
expect(
(await connectionStorage.load({ id }))?.connectionOptions
).to.deep.equal(connectionOptions);
});

it('saves a connection with arbitrary authMechanism', async function () {
const id = new UUID().toString();
await connectionStorage.save({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const ConnectionSchema: z.Schema<ConnectionWithLegacyProps> = z
useSystemCA: z.boolean().optional(), // Unused but may be present in legacy files
oidc: z.any().optional(),
fleOptions: z.any().optional(),
useApplicationLevelProxy: z.boolean().optional(),
}),
})
.optional(),
Expand Down