Files
rootandClaude Opus 5.5 89795802b5 docs(copy): 日志、计划、运行状态文案按 human-copy 重写
- 「立即执行」统一为「立即运行」,Toast 写「已加入队列」
- 巡检不再提「待处理」:触发条件写「有需要处理的事项时」,开关叫「生成巡检报告」
- 下载巡检触发条件写清包含失败的下载

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
2026-10-07 01:46:30 +08:00

57 lines
1.8 KiB
TypeScript

import { describe, expect, it } from "vitest";
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/logs?tab=schedules");
expect(planPath({ section: "auto" })).toBe("/console/logs?tab=schedules#auto");
expect(planPath({ section: "checks", job: "check.pending" })).toBe(
"/console/logs?tab=schedules&job=check.pending#checks",
);
});
it("运行记录跳日志页按定时任务筛选", () => {
expect(scheduleStreamPath("trash.purge")).toBe("/console/logs?objectType=scheduled_job&objectId=trash.purge");
});
it("formatUsd:两位小数,不足一分写 < $0.01", () => {
expect(formatUsd(undefined)).toBe("—");
expect(formatUsd(0)).toBe("$0");
expect(formatUsd(0.0031258)).toBe("< $0.01");
expect(formatUsd(0.0191)).toBe("$0.02");
expect(formatUsd(1.234)).toBe("$1.23");
});
it("间隔选项按天、小时、分钟、秒说", () => {
expect(INTERVAL_PRESETS.map((ms) => describeSchedule({ type: "interval", everyMs: ms }))).toEqual([
"每 30 秒",
"每 1 分钟",
"每 5 分钟",
"每 10 分钟",
"每 30 分钟",
"每 1 小时",
"每 6 小时",
"每 12 小时",
"每 1 天",
"每 7 天",
]);
});
});