mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 23:25:24 +00:00
feat: finish the remote-desktop plugin (B14)
This commit is contained in:
1 parent
0af2c94983
commit
14eb558b85
215 files changed
+30029
-3921
No files matched your search
@@ -0,0 +1,82 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
normalizeImportedHost,
|
||||
userDefaultParams,
|
||||
} from "../../src/backend/host-settings.js";
|
||||
|
||||
describe("normalizeImportedHost", () => {
|
||||
it("reads a Termix export's pluginSettings", () => {
|
||||
expect(
|
||||
normalizeImportedHost({
|
||||
pluginSettings: {
|
||||
"remote-desktop": {
|
||||
enableVnc: true,
|
||||
vncPort: 5901,
|
||||
guacamoleConfig: { cursor: "local" },
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
enableVnc: true,
|
||||
vncPort: 5901,
|
||||
guacamoleConfig: { cursor: "local" },
|
||||
});
|
||||
});
|
||||
|
||||
it("reads the flat fields hosts had before 2.9.0", () => {
|
||||
expect(
|
||||
normalizeImportedHost({
|
||||
enableRdp: true,
|
||||
rdpPort: "3390",
|
||||
security: "nla",
|
||||
ignoreCert: 1,
|
||||
guacamoleConfig: JSON.stringify({ dpi: 120 }),
|
||||
enableTerminalToolbar: false,
|
||||
}),
|
||||
).toEqual({
|
||||
enableRdp: true,
|
||||
rdpPort: 3390,
|
||||
rdpSecurity: "nla",
|
||||
rdpIgnoreCert: true,
|
||||
guacamoleConfig: { dpi: 120 },
|
||||
enableToolbar: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("turns a connectionType-only host into its switch and port", () => {
|
||||
expect(
|
||||
normalizeImportedHost({ connectionType: "telnet", port: 2323 }),
|
||||
).toEqual({ enableTelnet: true, telnetPort: 2323 });
|
||||
});
|
||||
|
||||
it("writes nothing for a plain SSH row", () => {
|
||||
expect(
|
||||
normalizeImportedHost({ connectionType: "ssh", port: 22 }),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("drops a port out of range", () => {
|
||||
expect(normalizeImportedHost({ enableRdp: true, rdpPort: 70000 })).toEqual({
|
||||
enableRdp: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("userDefaultParams", () => {
|
||||
it("maps the user settings onto guacd parameters, skipping inherit", () => {
|
||||
expect(
|
||||
userDefaultParams({
|
||||
colorDepth: "24",
|
||||
resizeMethod: "reconnect",
|
||||
disableCopy: "on",
|
||||
enableWallpaper: "off",
|
||||
enableDrive: "inherit",
|
||||
}),
|
||||
).toEqual({
|
||||
"color-depth": 24,
|
||||
"resize-method": "reconnect",
|
||||
"disable-copy": true,
|
||||
"enable-wallpaper": false,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user