fix(work-orders): hide Pending from existing status menus

This commit is contained in:
Alexandre Brandizzi 2026-09-29 11:28:26 -03:00
parent 73c7094102
commit b6d5ad8a1e
3 changed files with 7 additions and 7 deletions

View file

@ -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. */

View file

@ -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(
<StatusCell
@ -95,7 +95,7 @@ describe("StatusCell closability gate", () => {
);
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();

View file

@ -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",