fix: test

This commit is contained in:
LukeGus committed 2026-10-27 19:26:10 -05:00
1 parent ea0e614183
commit 4d41a02efa
2 files changed
+28 -4

No files matched your search

+6
View File
@@ -20,6 +20,7 @@ import { getTabType, type TabRenderProps } from "@/shell/tab-registry";
import { getPanel } from "@/shell/panel-registry"; import { getPanel } from "@/shell/panel-registry";
import { getSSHHosts } from "@/main-axios"; import { getSSHHosts } from "@/main-axios";
import { sshHostToHost } from "@/sidebar/HostManagerData"; import { sshHostToHost } from "@/sidebar/HostManagerData";
import { hostToSSHHost } from "@/lib/host-to-ssh-host";
import type { Host, Tab } from "@/types/ui-types"; import type { Host, Tab } from "@/types/ui-types";
import { createPluginApp } from "./app"; import { createPluginApp } from "./app";
import { installPluginHostBridge } from "./bridge"; import { installPluginHostBridge } from "./bridge";
@@ -150,6 +151,11 @@ function FrameBody({
key={`${view.view}:${view.hostId ?? ""}:${version}`} key={`${view.view}:${view.hostId ?? ""}:${version}`}
tab={record} tab={record}
host={host} host={host}
sshHost={
host
? (hostToSSHHost(host) as unknown as Record<string, unknown>)
: undefined
}
label={view.view} label={view.view}
isVisible isVisible
isFocusedPane isFocusedPane
+22 -4
View File
@@ -6,7 +6,14 @@ import type { PluginSummary } from "@/api/plugins-api";
vi.mock("@/main-axios", async (importOriginal) => ({ vi.mock("@/main-axios", async (importOriginal) => ({
...(await importOriginal<typeof import("@/main-axios")>()), ...(await importOriginal<typeof import("@/main-axios")>()),
getSSHHosts: vi.fn(async () => [ getSSHHosts: vi.fn(async () => [
{ id: 7, name: "web-01", ip: "10.0.0.7", port: 22, username: "root" }, {
id: 7,
name: "web-01",
ip: "10.0.0.7",
port: 22,
username: "root",
pluginSettings: { gizmo: { enableGizmo: true } },
},
]), ]),
})); }));
@@ -59,8 +66,19 @@ function Home() {
); );
} }
function HostView({ host }: { host?: { name: string } }) { function HostView({
return <p>host view: {host?.name ?? "none"}</p>; host,
sshHost,
}: {
host?: { name: string };
sshHost?: { pluginSettings?: { gizmo?: { enableGizmo?: boolean } } };
}) {
const on = sshHost?.pluginSettings?.gizmo?.enableGizmo === true;
return (
<p>
host view: {host?.name ?? "none"} {on ? "on" : "off"}
</p>
);
} }
const module = { const module = {
@@ -159,7 +177,7 @@ describe("startPluginFrame", () => {
shell: makeShell(), shell: makeShell(),
}), }),
); );
await waitFor(() => screen.getByText("host view: web-01")); await waitFor(() => screen.getByText("host view: web-01 on"));
act(() => frame!.setView({ view: "gizmo-home" })); act(() => frame!.setView({ view: "gizmo-home" }));
await waitFor(() => screen.getByText("hosts: web-01")); await waitFor(() => screen.getByText("hosts: web-01"));
act(() => frame!.setTheme({ id: "nord", mode: "dark" })); act(() => frame!.setTheme({ id: "nord", mode: "dark" }));