mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
fix: finish 2.9.0 plugin moves and get every check green
This commit is contained in:
1 parent
8c1e02af89
commit
6489b62ece
335 files changed
+29878
-17749
No files matched your search
@@ -27,7 +27,9 @@ afterEach(async () => {
|
||||
describe("ssh-terminal activate", () => {
|
||||
it("serves the terminal socket", async () => {
|
||||
server = await startServer();
|
||||
expect(server.mock.wsRoutes).toEqual([{ path: "/terminal", raw: false }]);
|
||||
expect(server.mock.wsRoutes).toMatchObject([
|
||||
{ path: "/terminal", raw: false },
|
||||
]);
|
||||
});
|
||||
|
||||
it("provides sessions.live as ssh and terminal.history", async () => {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { validateAdminSettings } from "../../src/backend/settings-validation.js";
|
||||
|
||||
describe("validateAdminSettings", () => {
|
||||
it("rejects relative image paths", () => {
|
||||
expect(
|
||||
Object.keys(
|
||||
validateAdminSettings({
|
||||
imageLocalDir: "images",
|
||||
imageHostPath: "tmp/images",
|
||||
}),
|
||||
).sort(),
|
||||
).toEqual(["imageHostPath", "imageLocalDir"]);
|
||||
});
|
||||
|
||||
it("accepts absolute paths and empty values", () => {
|
||||
expect(
|
||||
validateAdminSettings({ imageLocalDir: "", imageHostPath: "/tmp/img" }),
|
||||
).toEqual({});
|
||||
});
|
||||
});
|
||||
@@ -18,6 +18,8 @@ const mobileApi = vi.hoisted(() => ({
|
||||
const slots = vi.hoisted(() => ({
|
||||
toolbar: [] as Array<{ actionId: string; titleKey: string }>,
|
||||
invoked: [] as unknown[][],
|
||||
hostActions: [] as Array<Record<string, unknown>>,
|
||||
tabs: { openTab: vi.fn(), openSingletonTab: vi.fn() },
|
||||
}));
|
||||
|
||||
const labels: Record<string, string> = {
|
||||
@@ -52,6 +54,8 @@ vi.mock("@termix/plugin-sdk/frontend", async (importOriginal) => ({
|
||||
}),
|
||||
useSlotContributions: (slotId: string) =>
|
||||
slotId === "terminal.toolbar" ? slots.toolbar : [],
|
||||
useHostActions: () => slots.hostActions,
|
||||
useTabs: () => slots.tabs,
|
||||
}));
|
||||
|
||||
vi.mock("@termix/plugin-sdk/ui", async (importOriginal) => ({
|
||||
@@ -120,6 +124,7 @@ beforeEach(() => {
|
||||
localStorage.clear();
|
||||
slots.toolbar = [];
|
||||
slots.invoked = [];
|
||||
slots.hostActions = [];
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -875,6 +880,59 @@ describe("TerminalToolbar Phase 1", () => {
|
||||
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe("host quick links", () => {
|
||||
const Icon = () => null;
|
||||
|
||||
it("offers other plugins' open actions for this host", async () => {
|
||||
const run = vi.fn();
|
||||
slots.hostActions = [
|
||||
{
|
||||
id: "docker",
|
||||
titleKey: "Docker",
|
||||
icon: Icon,
|
||||
kind: "open",
|
||||
when: () => true,
|
||||
run,
|
||||
},
|
||||
{
|
||||
id: "gone",
|
||||
titleKey: "Hidden",
|
||||
icon: Icon,
|
||||
kind: "open",
|
||||
when: () => false,
|
||||
run,
|
||||
},
|
||||
{
|
||||
id: "terminal",
|
||||
titleKey: "Terminal",
|
||||
icon: Icon,
|
||||
kind: "connect",
|
||||
when: () => true,
|
||||
tabType: "terminal",
|
||||
},
|
||||
{
|
||||
id: "tunnel",
|
||||
titleKey: "Tunnels",
|
||||
icon: Icon,
|
||||
kind: "open",
|
||||
when: () => true,
|
||||
tabType: "tunnel",
|
||||
},
|
||||
];
|
||||
renderToolbar();
|
||||
|
||||
expect(screen.queryByRole("button", { name: "Hidden" })).toBeNull();
|
||||
expect(screen.queryByRole("button", { name: "Terminal" })).toBeNull();
|
||||
await userEvent.click(screen.getByRole("button", { name: "Docker" }));
|
||||
expect(run).toHaveBeenCalledTimes(1);
|
||||
await userEvent.click(screen.getByRole("button", { name: "Tunnels" }));
|
||||
expect(slots.tabs.openTab).toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
"tunnel",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("contributed toolbar actions", () => {
|
||||
it("shows no contributed button and no stray separator when nothing contributed", () => {
|
||||
const { container } = renderToolbar();
|
||||
|
||||
@@ -3,8 +3,8 @@ import type { Terminal } from "@xterm/xterm";
|
||||
|
||||
const getCookieMock = vi.fn<(name: string) => string | undefined>();
|
||||
|
||||
vi.mock("@termix/plugin-sdk/ui", () => ({
|
||||
getCookie: (name: string) => getCookieMock(name),
|
||||
vi.mock("@termix/plugin-sdk/frontend", () => ({
|
||||
getClientPreference: (name: string) => getCookieMock(name),
|
||||
}));
|
||||
|
||||
import {
|
||||
|
||||
Reference in new issue
Block a user