fix(web): 巡检目标模板的占位符显示成名称(FIX-7)

执行时 renderGoal 已正确替换(补单测);界面显示的是模板本身,{{now}} 等改成「当前时间」标签。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-30 00:00:03 +08:00
1 parent 417af9f253
commit 23bd8cfe45
5 files changed
+97 -6

No files matched your search

@@ -1,7 +1,24 @@
import { describe, expect, it } from "vitest";
import { describeSchedule, formatUsd, INTERVAL_PRESETS, planPath, scheduleStreamPath } from "./labels.ts";
import {
describeSchedule,
formatUsd,
goalTemplateParts,
INTERVAL_PRESETS,
planPath,
scheduleStreamPath,
} from "./labels.ts";
describe("计划页标签", () => {
it("巡检目标模板:占位符显示成名称(FIX-7)", () => {
expect(goalTemplateParts("巡检待处理({{now}}):有 {{ openDecisions }} 条,{{unknown}}")).toEqual([
{ text: "巡检待处理(" },
{ placeholder: "now", label: "当前时间" },
{ text: "):有 " },
{ placeholder: "openDecisions", label: "待处理事项数" },
{ text: " 条,{{unknown}}" },
]);
});
it("planPath:节锚点与 ?job= 高亮", () => {
expect(planPath()).toBe("/console/schedules");
expect(planPath({ section: "auto" })).toBe("/console/schedules#auto");