mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 07:05:24 +00:00
chore: lock the plugin boundary and remove 2.9.0 leftovers
This commit is contained in:
1 parent
6489b62ece
commit
2961297989
399 files changed
+3964
-5627
No files matched your search
@@ -8,7 +8,7 @@ import {
|
||||
waitFor,
|
||||
} from "@testing-library/react";
|
||||
import type { WebEndpoint } from "../../src/shared/web-endpoint-config";
|
||||
import type { Host } from "@/types/ui-types";
|
||||
import type { PluginHostRecord as Host } from "@termix/plugin-sdk/frontend";
|
||||
|
||||
const openWebEndpointTunnel = vi.hoisted(() => vi.fn());
|
||||
const allowInvalidCertificateForOrigin = vi.hoisted(() => vi.fn());
|
||||
@@ -31,9 +31,13 @@ vi.mock("../../src/frontend/web-endpoint-api", async (importOriginal) => {
|
||||
});
|
||||
|
||||
const electron = vi.hoisted(() => ({ isElectron: vi.fn(() => true) }));
|
||||
vi.mock("@/lib/electron", () => electron);
|
||||
vi.mock("@termix/plugin-sdk/ui", async (importOriginal) => ({
|
||||
...(await importOriginal<object>()),
|
||||
...electron,
|
||||
}));
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
vi.mock("react-i18next", async (importOriginal) => ({
|
||||
...(await importOriginal<object>()),
|
||||
useTranslation: () => ({ t: (key: string) => key }),
|
||||
}));
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ import {
|
||||
renderWithApp,
|
||||
type RenderedPluginApp,
|
||||
} from "@termix/plugin-sdk/testing";
|
||||
import { hostActionsFor, listHostActions } from "@/sidebar/host-contributions";
|
||||
import type { Host } from "@/types/ui-types";
|
||||
import type { PluginHostRecord as Host } from "@termix/plugin-sdk/frontend";
|
||||
import type { PluginManifest } from "@termix/plugin-sdk/manifest";
|
||||
import type { WebEndpoint } from "../../src/shared/web-endpoint-config";
|
||||
import * as plugin from "../../src/frontend/index";
|
||||
@@ -48,9 +47,9 @@ let rendered: RenderedPluginApp | null = null;
|
||||
|
||||
async function webAction(target: Host) {
|
||||
rendered ??= await renderWithApp(plugin, { manifest });
|
||||
return hostActionsFor(listHostActions(), target).find(
|
||||
(action) => action.id === "web-endpoint",
|
||||
);
|
||||
return rendered.registered
|
||||
.hostActionsFor(target)
|
||||
.find((action) => action.id === "web-endpoint");
|
||||
}
|
||||
|
||||
afterEach(async () => {
|
||||
|
||||
@@ -2,14 +2,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { WebEndpoint } from "../../src/shared/web-endpoint-config";
|
||||
|
||||
const isElectron = vi.hoisted(() => vi.fn(() => false));
|
||||
vi.mock("@/lib/electron", () => ({ isElectron }));
|
||||
vi.mock("@termix/plugin-sdk/ui", async (importOriginal) => ({
|
||||
...(await importOriginal<object>()),
|
||||
isElectron,
|
||||
}));
|
||||
|
||||
const pluginPost = vi.hoisted(() => vi.fn());
|
||||
vi.mock("@/main-axios", () => ({
|
||||
handleApiError: (error: unknown) => {
|
||||
throw new Error(`generic: ${String(error)}`);
|
||||
},
|
||||
}));
|
||||
|
||||
function endpoint(overrides: Partial<WebEndpoint> = {}): WebEndpoint {
|
||||
return {
|
||||
@@ -94,7 +92,9 @@ describe("openWebEndpointTunnel", () => {
|
||||
);
|
||||
const { openWebEndpointTunnel } =
|
||||
await import("../../src/frontend/web-endpoint-api");
|
||||
await expect(openWebEndpointTunnel(7, "e1")).rejects.toThrow(/generic:/);
|
||||
await expect(openWebEndpointTunnel(7, "e1")).rejects.toThrow(
|
||||
/Could not open web endpoint tunnel/,
|
||||
);
|
||||
});
|
||||
|
||||
it("treats a missing port as a failure rather than returning undefined", async () => {
|
||||
|
||||
Reference in new issue
Block a user