Files
fusion/packages/dashboard/app/utils/__tests__/taskAgeStalenessCopy.test.ts
Fusion 927a32182d feat(FN-4465): complete Step 4 — dashboard stale signal surfacing
Fusion-Task-Id: FN-4465
Fusion-Task-Lineage: 4365d4cb-ab93-4ed5-add9-3e14b26237ad
2026-05-14 05:55:16 -07:00

40 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { getTaskAgeStalenessCopy, shouldShowTaskAgeStalenessBadge } from "../taskAgeStalenessCopy";
describe("taskAgeStalenessCopy", () => {
it("returns warning copy", () => {
const copy = getTaskAgeStalenessCopy({
level: "warning",
reason: "",
observedAt: "2026-05-14T00:00:00.000Z",
ageMs: 26 * 60 * 60_000,
warningThresholdMs: 24 * 60 * 60_000,
criticalThresholdMs: 72 * 60 * 60_000,
column: "in-review",
paused: false,
});
expect(copy?.badgeTone).toBe("warning");
expect(copy?.description).not.toContain("while paused");
});
it("returns critical + paused phrasing", () => {
const copy = getTaskAgeStalenessCopy({
level: "critical",
reason: "",
observedAt: "2026-05-14T00:00:00.000Z",
ageMs: 80 * 60 * 60_000,
warningThresholdMs: 24 * 60 * 60_000,
criticalThresholdMs: 72 * 60 * 60_000,
column: "in-review",
paused: true,
});
expect(copy?.badgeTone).toBe("critical");
expect(copy?.description).toContain("while paused");
});
it("returns null/false when absent", () => {
expect(getTaskAgeStalenessCopy(undefined)).toBeNull();
expect(shouldShowTaskAgeStalenessBadge({ ageStaleness: undefined })).toBe(false);
});
});