mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 22:25:24 +00:00
feat: type the plugin host record, move plugin strings out of core and add lint checks
This commit is contained in:
1 parent
bba06f7ff6
commit
b8bbcd2196
626 files changed
+23884
-4590
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { toHostRecord } from "@/plugin-host/bridge";
|
||||
|
||||
describe("toHostRecord", () => {
|
||||
it("copies only the fields the SDK types", () => {
|
||||
const record = toHostRecord({
|
||||
id: 7,
|
||||
name: "web",
|
||||
ip: "10.0.0.7",
|
||||
port: 22,
|
||||
username: "root",
|
||||
parentHostId: 3,
|
||||
jumpHosts: [{ hostId: 2 }],
|
||||
pluginSettings: { docker: { enableDocker: true } },
|
||||
authOverrides: { ssh: { required: true, ownerAuthShared: false } },
|
||||
password: "secret",
|
||||
terminalConfig: { fontSize: 14 },
|
||||
enableDocker: true,
|
||||
} as never);
|
||||
|
||||
expect(record).toMatchObject({
|
||||
id: "7",
|
||||
name: "web",
|
||||
parentHostId: "3",
|
||||
jumpHosts: [{ hostId: 2 }],
|
||||
pluginSettings: { docker: { enableDocker: true } },
|
||||
authOverrides: { ssh: { required: true, ownerAuthShared: false } },
|
||||
});
|
||||
const loose = record as unknown as Record<string, unknown>;
|
||||
expect(loose).not.toHaveProperty("password");
|
||||
expect(loose).not.toHaveProperty("terminalConfig");
|
||||
expect(loose).not.toHaveProperty("enableDocker");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user