Files
fusion/packages/dashboard/app/utils/__tests__/taskStatusBadgeLabel.test.ts
gsxdsm 7f175b036b FN-8195: label replan task status
Display the needs-replan task state with a clear localized operator-facing label.

- Map needs-replan status badges to Replan centrally.
- Add English i18n resources and generated resource typings.
- Cover the status-label mapping and add a patch changeset.

Files changed:
 .changeset/fn-8195-replan-badge.md                                | 7 +++++++
 .../dashboard/app/utils/__tests__/taskStatusBadgeLabel.test.ts    | 4 ++++
 packages/dashboard/app/utils/taskStatusBadgeLabel.ts              | 8 ++++++++
 packages/i18n/locales/en/app.json                                 | 2 ++
 packages/i18n/src/resources.d.ts                                  | 2 ++
 5 files changed, 23 insertions(+)

Fusion-Task-Id: FN-8195

Fusion-Task-Lineage: 7ad115b8-6405-426e-9201-bfa1258fff5e

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-17 01:07:52 -07:00

47 lines
2.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import type { TFunction } from "i18next";
import { getTaskStatusBadgeLabel, shouldSuppressPlanningStatusBadge } from "../taskStatusBadgeLabel";
const t = ((key: string, fallback?: string) => fallback ?? key) as TFunction<"app">;
describe("shouldSuppressPlanningStatusBadge", () => {
it.each([
{ status: "planning", column: "todo", suppressed: true },
{ status: "planning", column: "in-progress", suppressed: true },
{ status: "planning", column: "triage", suppressed: false },
{ status: "executing", column: "todo", suppressed: false },
{ status: "executing", column: "in-progress", suppressed: false },
{ status: "reviewing", column: "todo", suppressed: false },
{ status: "merging", column: "in-progress", suppressed: false },
{ status: "failed", column: "todo", suppressed: false },
{ status: "needs-replan", column: "in-progress", suppressed: false },
{ status: "done", column: "todo", suppressed: false },
{ status: null, column: "in-progress", suppressed: false },
{ status: undefined, column: "todo", suppressed: false },
])("suppresses only stale planning status for Todo and In Progress: $status/$column", ({ status, column, suppressed }) => {
expect(shouldSuppressPlanningStatusBadge({ status, column })).toBe(suppressed);
});
});
describe("getTaskStatusBadgeLabel", () => {
it("maps the full AI merge pipeline to Merging…", () => {
for (const status of ["merging", "merging-pr", "reviewing", "landing"]) {
expect(getTaskStatusBadgeLabel(status, t)).toBe("Merging…");
}
});
it("keeps merging-fix distinct", () => {
expect(getTaskStatusBadgeLabel("merging-fix", t)).toBe("Merging fixes…");
});
it("maps needs-replan to the operator-facing Replan label", () => {
expect(getTaskStatusBadgeLabel("needs-replan", t)).toBe("Replan");
});
it("passes through non-merge statuses", () => {
expect(getTaskStatusBadgeLabel("planning", t)).toBe("planning");
expect(getTaskStatusBadgeLabel("failed", t)).toBe("failed");
expect(getTaskStatusBadgeLabel(null, t)).toBe("");
});
});