27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { hwpodNativeProxy, parseHwpodNativeAccessProfile } from "./hwpod-native-vite.config";
|
|
import { firstAllowedNavPath } from "../src/stores/auth";
|
|
|
|
describe("HWPOD native Cloud Console profile", () => {
|
|
it("accepts the YAML-rendered HWPOD-only navigation profile", () => {
|
|
const profile = parseHwpodNativeAccessProfile(JSON.stringify({
|
|
id: "hwpod-native-l1",
|
|
allowedNavIds: ["admin.hwpodGroups"],
|
|
startPath: "/hwpods/devices",
|
|
}));
|
|
expect(profile).toEqual({ id: "hwpod-native-l1", allowedNavIds: ["admin.hwpodGroups"], startPath: "/hwpods/devices" });
|
|
expect(firstAllowedNavPath(profile.allowedNavIds)).toBe(profile.startPath);
|
|
});
|
|
|
|
it("fails closed without a declared navigation profile", () => {
|
|
expect(() => parseHwpodNativeAccessProfile(undefined)).toThrow(/HWPOD_WEB_ACCESS_PROFILE_JSON/u);
|
|
});
|
|
|
|
it("proxies onboarding metadata and downloads to the independent HWPOD API", () => {
|
|
expect(hwpodNativeProxy("http://127.0.0.1:6681")).toMatchObject({
|
|
"/v1/hwlab-node": { target: "http://127.0.0.1:6681", changeOrigin: false },
|
|
});
|
|
});
|
|
});
|