feat(connection): add dedicated ssh tunnel test button

This commit is contained in:
zipg authored and GitHub committed 2026-09-01 15:07:51 +08:00
1 parent f19439ad7a
commit 6588f27fbc
18 files changed
+228 -21

No files matched your search

@@ -0,0 +1,25 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const dialogSource = readFileSync(new URL("../../../components/connection/ConnectionDialog.vue", import.meta.url), "utf8");
describe("ConnectionDialog SSH tunnel test", () => {
it("exposes a dedicated SSH tunnel test without running the database test", () => {
expect(dialogSource).toContain("async function testSshTunnel()");
expect(dialogSource).toContain("await api.testSshTunnel(config)");
expect(dialogSource).toContain('@click="testSshTunnel"');
expect(dialogSource).toContain('t("connection.sshTunnelTest")');
});
it("builds the tunnel probe config without database-specific validation", () => {
const start = dialogSource.indexOf("function connectionConfigForSshTunnelTest");
const end = dialogSource.indexOf("function connectionConfigForSubmit", start);
const helperSource = dialogSource.slice(start, end);
expect(start).toBeGreaterThan(-1);
expect(end).toBeGreaterThan(start);
expect(helperSource).toContain("normalizeTransportLayersForSubmit(config)");
expect(helperSource).not.toContain("kingbaseDatabaseRequired");
expect(helperSource).not.toContain("dynamodbCredentialsRequired");
});
});