mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-31 15:45:23 +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
@@ -1,41 +1,51 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createQuickConnectHost } from "@/sidebar/quick-connect-host";
|
||||
import { quickConnectGuacHost } from "../../src/frontend/quick-connect-guac-host";
|
||||
|
||||
// The shape core's Quick Connect builds for a plugin protocol: the switch and
|
||||
// port in this plugin's host settings, the login on the protocol's fields.
|
||||
function quickHost(protocol: "rdp" | "vnc", extra: Record<string, unknown>) {
|
||||
return {
|
||||
id: "quick-connect-1",
|
||||
name: "admin@10.0.0.2",
|
||||
ip: "10.0.0.2",
|
||||
pluginSettings: {
|
||||
"remote-desktop": {
|
||||
[protocol === "rdp" ? "enableRdp" : "enableVnc"]: true,
|
||||
[protocol === "rdp" ? "rdpPort" : "vncPort"]:
|
||||
protocol === "rdp" ? 3390 : 5901,
|
||||
},
|
||||
},
|
||||
...extra,
|
||||
};
|
||||
}
|
||||
|
||||
describe("quickConnectGuacHost", () => {
|
||||
it("carries an RDP quick connect's address and credentials", () => {
|
||||
const host = createQuickConnectHost({
|
||||
ip: "10.0.0.2",
|
||||
port: 3390,
|
||||
username: "admin",
|
||||
authType: "password",
|
||||
password: "pw",
|
||||
protocol: "rdp",
|
||||
domain: "CORP",
|
||||
});
|
||||
expect(quickConnectGuacHost(host)).toMatchObject({
|
||||
expect(
|
||||
quickConnectGuacHost(
|
||||
quickHost("rdp", {
|
||||
rdpUser: "admin",
|
||||
rdpPassword: "pw",
|
||||
domain: "CORP",
|
||||
}),
|
||||
),
|
||||
).toMatchObject({
|
||||
ip: "10.0.0.2",
|
||||
connectionType: "rdp",
|
||||
rdpPort: 3390,
|
||||
rdpUser: "admin",
|
||||
rdpPassword: "pw",
|
||||
port: 3390,
|
||||
username: "admin",
|
||||
password: "pw",
|
||||
domain: "CORP",
|
||||
});
|
||||
});
|
||||
|
||||
it("puts a VNC quick connect's password on the VNC fields", () => {
|
||||
const host = createQuickConnectHost({
|
||||
ip: "10.0.0.3",
|
||||
port: 5901,
|
||||
username: "",
|
||||
authType: "password",
|
||||
password: "vncpw",
|
||||
protocol: "vnc",
|
||||
});
|
||||
expect(quickConnectGuacHost(host)).toMatchObject({
|
||||
it("takes a VNC quick connect's login from the VNC fields", () => {
|
||||
expect(
|
||||
quickConnectGuacHost(quickHost("vnc", { vncPassword: "vncpw" })),
|
||||
).toMatchObject({
|
||||
connectionType: "vnc",
|
||||
vncPort: 5901,
|
||||
vncPassword: "vncpw",
|
||||
port: 5901,
|
||||
password: "vncpw",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user