fix: split up proxmox secrets are incorrectly migrated (#2124)
This commit is contained in:
46
packages/old-import/src/mappers/test/map-integration.spec.ts
Normal file
46
packages/old-import/src/mappers/test/map-integration.spec.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { describe, expect, test, vi } from "vitest";
|
||||
|
||||
import * as commonServer from "@homarr/common/server";
|
||||
|
||||
import type { PreparedIntegration } from "../../prepare/prepare-integrations";
|
||||
import { mapAndDecryptIntegrations } from "../map-integration";
|
||||
|
||||
describe("Map Integrations", () => {
|
||||
test("should map proxmox integration", () => {
|
||||
vi.spyOn(commonServer, "decryptSecretWithKey").mockReturnValue("user@realm!tokenId=secret");
|
||||
|
||||
const proxmoxIntegration: PreparedIntegration = {
|
||||
type: "proxmox",
|
||||
name: "Proxmox",
|
||||
url: "https://proxmox.com",
|
||||
properties: [
|
||||
{
|
||||
field: "apiKey",
|
||||
value: "any-encrypted-value",
|
||||
type: "private",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const mappedIntegrations = mapAndDecryptIntegrations([proxmoxIntegration], "encryptionToken");
|
||||
|
||||
expect(mappedIntegrations[0]?.secrets).toEqual([
|
||||
{
|
||||
field: "username",
|
||||
value: "user",
|
||||
},
|
||||
{
|
||||
field: "realm",
|
||||
value: "realm",
|
||||
},
|
||||
{
|
||||
field: "tokenId",
|
||||
value: "tokenId",
|
||||
},
|
||||
{
|
||||
field: "apiKey",
|
||||
value: "secret",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user