mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
Snowflake is a built-in data source kind: connection dialog, key-pair, browser single sign-on, password or token sign-in, the database tree, SQL consoles, and Snowflake-aware SQL assistance and syntax colours. The driver speaks Snowflake's session protocol over the existing reqwest + rustls stack, with no JDBC/ODBC or native library and no new package. Metadata is read with SHOW / DESCRIBE, which need no running warehouse; introspected names are kept on disk for completion. Co-authored-by: vvnadolskyy <12991410+vvnadolskyy@users.noreply.github.com>
45 lines
2.0 KiB
TypeScript
45 lines
2.0 KiB
TypeScript
import { fireEvent, render, screen, within } from "@testing-library/react";
|
|
import { describe, expect, it } from "vitest";
|
|
import { SourceDialog } from "./SourceDialog";
|
|
|
|
const savePassword = () => screen.getByRole("checkbox", { name: "Save password" }) as HTMLInputElement;
|
|
|
|
describe("new data source", () => {
|
|
it("does not save the database password unless asked to", () => {
|
|
render(<SourceDialog initial={null} />);
|
|
expect(savePassword().checked).toBe(false);
|
|
});
|
|
|
|
it("does not save the SSH tunnel password unless asked to", () => {
|
|
render(<SourceDialog initial={null} />);
|
|
fireEvent.click(screen.getByRole("tab", { name: "SSH/SSL" }));
|
|
fireEvent.click(screen.getByRole("checkbox", { name: "Use SSH tunnel" }));
|
|
fireEvent.click(screen.getByRole("button", { name: "SSH authentication type" }));
|
|
fireEvent.click(within(screen.getByRole("listbox")).getByText("Password"));
|
|
expect(savePassword().checked).toBe(false);
|
|
});
|
|
|
|
it("names the secret of a Snowflake source after its authentication method", () => {
|
|
render(
|
|
<SourceDialog
|
|
initial={null}
|
|
preset={{
|
|
driver: "snowflake",
|
|
host: "",
|
|
snowflake: { warehouse: "", role: "", auth: "keyPair", privateKeyFile: "" },
|
|
}}
|
|
/>,
|
|
);
|
|
expect(screen.getByText("Account:")).toBeTruthy();
|
|
expect(screen.queryByRole("tab", { name: "SSH/SSL" })).toBeNull();
|
|
expect(screen.getByLabelText("Private key:")).toBeTruthy();
|
|
expect((screen.getByLabelText("Passphrase:") as HTMLInputElement).type).toBe("password");
|
|
expect(savePassword().checked).toBe(false);
|
|
fireEvent.click(screen.getByRole("button", { name: "Snowflake authentication" }));
|
|
fireEvent.click(within(screen.getByRole("listbox")).getByText("Password"));
|
|
expect(screen.queryByLabelText("Private key:")).toBeNull();
|
|
expect((screen.getByLabelText("Password:") as HTMLInputElement).type).toBe("password");
|
|
for (const field of ["Schema:", "Warehouse:", "Role:"]) expect(screen.getByLabelText(field)).toBeTruthy();
|
|
});
|
|
});
|