From b6d5ad8a1eeb28c158d38ee8a4a5915ac7370a03 Mon Sep 17 00:00:00 2001 From: Alexandre Brandizzi Date: Tue, 29 Sep 2026 11:28:26 -0300 Subject: [PATCH] fix(work-orders): hide Pending from existing status menus --- src/domain/work-orders/utils/wo-lifecycle-transitions.ts | 6 ++++-- .../(protected)/workorders/status-cell-closability.test.tsx | 6 +++--- .../work-orders/utils/wo-lifecycle-transitions.test.ts | 2 -- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/domain/work-orders/utils/wo-lifecycle-transitions.ts b/src/domain/work-orders/utils/wo-lifecycle-transitions.ts index f0184ef9..e0351242 100644 --- a/src/domain/work-orders/utils/wo-lifecycle-transitions.ts +++ b/src/domain/work-orders/utils/wo-lifecycle-transitions.ts @@ -17,9 +17,11 @@ import { */ export const AUTOMATIC_LIFECYCLE_STATUSES: readonly WizardWOStatus[] = ["Incomplete", "Scheduled"]; -/** Manually selectable statuses for an existing WO — Canceled is kebab-only. */ +/** + * Manually selectable statuses for an existing WO. Pending is creation-only; Canceled is kebab-only. + */ export const BOARD_INLINE_STATUSES: readonly WizardWOStatus[] = ALL_WIZARD_STATUSES.filter( - (status) => !AUTOMATIC_LIFECYCLE_STATUSES.includes(status), + (status) => status !== "Pending" && !AUTOMATIC_LIFECYCLE_STATUSES.includes(status), ); /** Inline options for an existing WO never repeat its current status. */ diff --git a/src/test/app/(protected)/workorders/status-cell-closability.test.tsx b/src/test/app/(protected)/workorders/status-cell-closability.test.tsx index 7f42d257..63cd8eb8 100644 --- a/src/test/app/(protected)/workorders/status-cell-closability.test.tsx +++ b/src/test/app/(protected)/workorders/status-cell-closability.test.tsx @@ -70,10 +70,10 @@ describe("StatusCell closability gate", () => { expect(offered).not.toContain("Scheduled"); expect(offered).not.toContain("Past Due"); expect(offered).not.toContain("Canceled"); + expect(offered).not.toContain("Pending"); expect(offered).not.toContain(current); expect(offered).toEqual( [ - "Pending", "En Route", "On Site", "In Progress", @@ -84,7 +84,7 @@ describe("StatusCell closability gate", () => { ); }); - it("offers every manual status, and no automatic one, from Incomplete or Scheduled", () => { + it("omits Pending and automatic statuses from Incomplete or Scheduled", () => { for (const current of ["Incomplete", "Scheduled"] as const) { const { unmount } = render( { ); fireEvent.click(screen.getByRole("button", { name: new RegExp(current, "i") })); - expect(screen.getByRole("button", { name: /^pending$/i })).toBeTruthy(); + expect(screen.queryByRole("button", { name: /^pending$/i })).toBeNull(); expect(screen.queryByRole("button", { name: /^incomplete$/i })).toBeNull(); expect(screen.queryByRole("button", { name: /^scheduled$/i })).toBeNull(); unmount(); diff --git a/src/test/domain/work-orders/utils/wo-lifecycle-transitions.test.ts b/src/test/domain/work-orders/utils/wo-lifecycle-transitions.test.ts index 75ea23c6..b22e4357 100644 --- a/src/test/domain/work-orders/utils/wo-lifecycle-transitions.test.ts +++ b/src/test/domain/work-orders/utils/wo-lifecycle-transitions.test.ts @@ -21,7 +21,6 @@ import type { WorkOrderTableRow } from "@/domain/work-orders/types/work-order-ta describe("wo-lifecycle-transitions", () => { it("lists only manual board statuses: no automatic states and no Canceled (SH-169)", () => { expect(BOARD_INLINE_STATUSES).toEqual([ - "Pending", "En Route", "On Site", "In Progress", @@ -37,7 +36,6 @@ describe("wo-lifecycle-transitions", () => { it("never offers the current status as a transition (SH-358)", () => { expect(getInlineStatusTransitions("On Site")).toEqual([ - "Pending", "En Route", "In Progress", "Completed",