offPeakTaskIdentity.test.ts 781 B

1234567891011121314151617181920
  1. import { describe, expect, it } from "vitest";
  2. import { isOffPeakTask } from "../src/zcode-task-types.js";
  3. // D48:闲时会话/幻影行的月亮身份只看持久 meta 标记,不再依赖 UI 反查 off-peak store。
  4. describe("isOffPeakTask", () => {
  5. it("携带 offPeakTaskId 标记的 task 判定为闲时任务", () => {
  6. expect(isOffPeakTask({ offPeakTaskId: "offpeak-1" })).toBe(true);
  7. });
  8. it("无标记或空标记不判定为闲时任务", () => {
  9. expect(isOffPeakTask({})).toBe(false);
  10. expect(isOffPeakTask({ offPeakTaskId: undefined })).toBe(false);
  11. });
  12. it("与 cron 标记互不干扰(D45 兄弟实体各用各的标记)", () => {
  13. expect(isOffPeakTask({ cronAutomationId: "automation-1" } as never)).toBe(
  14. false,
  15. );
  16. });
  17. });