test(work-orders): keep Verified and Completed as live company assignment (SH-183)

Cancelled/Canceled/Refused stay inactive; verified or completed dispatches still
gate Complete on the vendor that did the work.
This commit is contained in:
Arthur Bassi 2026-08-19 15:16:23 -03:00
parent b3899d2a51
commit 854267e213

View file

@ -349,6 +349,29 @@ describe("detailToClosabilityInput", () => {
},
);
it.each(["Verified", "Completed", "Sent"])(
"treats dispatch status %s as a live company assignment (SH-183)",
(status) => {
const liveAssignment = {
assignedTo: "Alice",
completedDate: "2026-07-15",
workOrderNumber: "20260623001",
internalWONumber: "SH-1",
problem: "HVAC PM",
source: "procurement-integration",
type: "",
docStatus: "",
mediaCount: 0,
dispatches: [{ vendorName: "ACME Tech", vendorId: 45, status }],
} as WorkOrderDetail;
const input = detailToClosabilityInput(liveAssignment);
expect(input.company).toBe("ACME Tech");
expect(input.vendorId).toBe("45");
expect(getClosabilityGaps(input)).toEqual([]);
},
);
it("uses the active dispatch after an inactive cancelled spelling (SH-183)", () => {
const supersededThenCurrent = {
assignedTo: "Alice",