mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 07:05:24 +00:00
fix(hosts): display protocol credential usernames for non-SSH hosts (#1572)
This commit is contained in:
1 parent
bb4b345feb
commit
42c5682243
4 files changed
+88
-4
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { registerHostProtocol } from "@/sidebar/host-protocols";
|
||||
import {
|
||||
act,
|
||||
cleanup,
|
||||
@@ -402,3 +403,42 @@ describe("HostItem row fields", () => {
|
||||
).toBe("root@10.0.0.5");
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the enabled protocol username for non-SSH hosts", () => {
|
||||
const dispose = registerHostProtocol({
|
||||
id: "rdp",
|
||||
pluginId: "remote-desktop",
|
||||
settingKey: "enableRdp",
|
||||
defaultPort: 3389,
|
||||
titleKey: "rdp",
|
||||
icon: () => null,
|
||||
});
|
||||
try {
|
||||
const host: Host = {
|
||||
...baseHost,
|
||||
enableSsh: false,
|
||||
pluginSettings: { "remote-desktop": { enableRdp: true } },
|
||||
protocolAuth: {
|
||||
rdp: {
|
||||
authType: "credential",
|
||||
credentialId: 6,
|
||||
username: "Administrator",
|
||||
fields: {},
|
||||
},
|
||||
},
|
||||
};
|
||||
const fields = { showUsername: true, showPort: false };
|
||||
expect(formatHostAddress(host, fields)).toBe("Administrator@10.0.0.5");
|
||||
expect(formatHostAddress({ ...host, enableSsh: true }, fields)).toBe(
|
||||
"root@10.0.0.5",
|
||||
);
|
||||
expect(formatHostAddress({ ...host, protocolAuth: {} }, fields)).toBe(
|
||||
"10.0.0.5",
|
||||
);
|
||||
expect(formatHostAddress(host, { ...fields, showUsername: false })).toBe(
|
||||
"10.0.0.5",
|
||||
);
|
||||
} finally {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user