mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
fix: test
This commit is contained in:
1 parent
ea0e614183
commit
4d41a02efa
2 files changed
+28
-4
No files matched your search
@@ -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
|
||||||
|
|||||||
@@ -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" }));
|
||||||
|
|||||||
Reference in new issue
Block a user