taskRowOffPeakMetaMarker.test.ts 1.1 KB

12345678910111213141516171819202122232425
  1. // D48 MR1:月亮标识从 off-peak store 反查切换为持久 meta 判断(isOffPeakTask)。
  2. // 行为不变(图标/位置一致),数据源变化用源码断言锁定,防止回退到 store 订阅。
  3. import { readFileSync } from "node:fs";
  4. import { resolve } from "node:path";
  5. import { describe, expect, it } from "vitest";
  6. function readSource(relativePath: string): string {
  7. return readFileSync(resolve(process.cwd(), relativePath), "utf8");
  8. }
  9. describe("off-peak 月亮标识走持久 meta 标记", () => {
  10. for (const relativePath of [
  11. "packages/ui/src/workspace-grouped-tasks/task-row.tsx",
  12. "packages/ui/src/TaskListItem.tsx",
  13. ]) {
  14. it(`${relativePath} 使用 isOffPeakTask 且不再反查 off-peak store`, () => {
  15. const source = readSource(relativePath);
  16. expect(source).toContain("isOffPeakTask(task)");
  17. expect(source).not.toContain("offPeakTask.sessionId === task.taskId");
  18. // 图标本体与可达性标签保持不变。
  19. expect(source).toContain("data-off-peak-task-icon");
  20. expect(source).toContain("taskList.offPeakTaskLabel");
  21. });
  22. }
  23. });