mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 23:25:24 +00:00
feat: make each plugin an npm workspace built by a termix-plugin CLI
This commit is contained in:
1 parent
4758016f41
commit
5796186a1c
448 files changed
+3087
-2003
No files matched your search
@@ -0,0 +1,59 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveProxmoxImportAuth } from "../../src/frontend/proxmox-import-auth";
|
||||
|
||||
describe("resolveProxmoxImportAuth", () => {
|
||||
it("inherits an available credential even with the default 'password' authType", () => {
|
||||
// Regression guard: a Proxmox host authenticating via a Termix credential
|
||||
// used to yield authType 'none' for imported guests because the default
|
||||
// authType is 'password', not 'credential'.
|
||||
expect(resolveProxmoxImportAuth("password", 42)).toEqual({
|
||||
authType: "credential",
|
||||
credentialId: 42,
|
||||
overrideCredentialUsername: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the credential when authType is explicitly 'credential'", () => {
|
||||
expect(resolveProxmoxImportAuth("credential", 7)).toEqual({
|
||||
authType: "credential",
|
||||
credentialId: 7,
|
||||
overrideCredentialUsername: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the credential when no authType is given", () => {
|
||||
expect(resolveProxmoxImportAuth(undefined, 5)).toEqual({
|
||||
authType: "credential",
|
||||
credentialId: 5,
|
||||
overrideCredentialUsername: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("lets an explicit secretless authType win over an available credential", () => {
|
||||
expect(resolveProxmoxImportAuth("none", 42)).toEqual({ authType: "none" });
|
||||
expect(resolveProxmoxImportAuth("tailscale", 42)).toEqual({
|
||||
authType: "tailscale",
|
||||
});
|
||||
expect(resolveProxmoxImportAuth("agent", 42)).toEqual({
|
||||
authType: "agent",
|
||||
});
|
||||
});
|
||||
|
||||
it("falls back to 'none' when no credential is available", () => {
|
||||
expect(resolveProxmoxImportAuth("password", null)).toEqual({
|
||||
authType: "none",
|
||||
});
|
||||
expect(resolveProxmoxImportAuth("key", undefined)).toEqual({
|
||||
authType: "none",
|
||||
});
|
||||
expect(resolveProxmoxImportAuth(undefined, undefined)).toEqual({
|
||||
authType: "none",
|
||||
});
|
||||
});
|
||||
|
||||
it("passes through a non secret-backed special type without a credential", () => {
|
||||
expect(resolveProxmoxImportAuth("opkssh", null)).toEqual({
|
||||
authType: "opkssh",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user