Files
pikasTech-HWLAB/web/hwlab-cloud-web/scripts/hwpod-native-vite-config.test.ts
T
2026-07-21 08:46:18 +02:00

21 lines
885 B
TypeScript

import { describe, expect, it } from "vitest";
import { 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);
});
});