Files
openidea/src/features/services/connectionDialog.test.tsx
T
l0ng-ai 1679d61a6a fix(services): list the SSH configurations in the Docker connection dialog (#3570)
SshConfigSelect reads the settings window's staged ssh.configs unless given a list, and that list is empty outside the settings window, so the Docker connection dialog offered only None. The dialog now passes the live list; the None choice gets its Chinese text.

Closes #3535
2026-11-15 23:51:21 +08:00

38 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { act, cleanup, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
import type { Settings } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { openConnectionDialog, ServicesDialogHost } from "./dialogs";
afterEach(() => {
cleanup();
useProject.setState({ settings: null });
});
describe("Docker connection dialog", () => {
it("offers the SSH configurations of Settings › Tools › SSH Configurations", () => {
const config = {
id: "ssh1",
name: "Build server",
host: "build-server",
port: 2222,
user: "ops",
auth: "openSsh",
keyFile: "",
saveSecret: false,
};
useProject.setState({ settings: { ssh: { configs: [config] } } as unknown as Settings });
render(<ServicesDialogHost />);
act(() =>
openConnectionDialog({
id: "c1",
name: "Docker",
endpoint: { kind: "tcp", host: "ssh://ops@build-server:2222", tlsCertDir: null },
} as never),
);
const picker = screen.getByRole("button", { name: /SSH configuration/ });
expect(picker.textContent).toContain("Build server");
expect(picker.textContent).not.toContain("missing");
});
});