- cards grouped by collect / download / organize / maintain / agent checks: switch, in-place interval or cron edit, last result and duration, next-run countdown, failure reason, run now, skip next, reset to default, history drawer - top stats (enabled / failed / running / total) and a scheduler-offline notice; refreshed by the schedule.changed SSE event with a 30s fallback - agent check cards show goal template, trigger, budget and allowlist size; create / edit dialog (read-only capabilities, budget, trigger, interval, report to inbox) - nav entry in the system group, route and smoke route Co-Authored-By: Claude Opus 5.5 <[email protected]>
24 lines
990 B
TypeScript
24 lines
990 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { consolePath, findNavItem, NAV_ITEMS } from "./nav.ts";
|
|
|
|
describe("控制台导航", () => {
|
|
it("12 个工作区 + 定时任务 + 引擎面板 + 审计,路径唯一且都在 /console 下", () => {
|
|
expect(NAV_ITEMS).toHaveLength(16);
|
|
expect(new Set(NAV_ITEMS.map((i) => i.to)).size).toBe(16);
|
|
expect(NAV_ITEMS.every((i) => i.to.startsWith("/console"))).toBe(true);
|
|
});
|
|
|
|
it("按最长前缀匹配当前项", () => {
|
|
expect(findNavItem("/console")?.label).toBe("首页");
|
|
expect(findNavItem("/console/")?.label).toBe("首页");
|
|
expect(findNavItem("/console/library/abc")?.label).toBe("媒体库");
|
|
expect(findNavItem("/console/engine/r1")?.label).toBe("工作流引擎");
|
|
expect(findNavItem("/nope")).toBeUndefined();
|
|
});
|
|
|
|
it("consolePath 拼路径并编码", () => {
|
|
expect(consolePath()).toBe("/console");
|
|
expect(consolePath("library", "a b")).toBe("/console/library/a%20b");
|
|
});
|
|
});
|