mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-02 10:53:13 +00:00
Clear leftover primary dispatch status on vendor patch so Completed is not blocked after a new company is chosen. Keep Jira keys out of source comments.
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { toVendorTablePatch } from "@/domain/work-orders/utils/vendor-assignment-patch";
|
|
import {
|
|
getClosabilityGaps,
|
|
tableRowToClosabilityInput,
|
|
} from "@/domain/work-orders/utils/wo-closability";
|
|
import type { WorkOrderTableRow } from "@/domain/work-orders/types/work-order-table-row";
|
|
|
|
describe("toVendorTablePatch", () => {
|
|
it("clears leftover primaryDispatchStatus so a new vendor is a live assignment", () => {
|
|
const patch = toVendorTablePatch({
|
|
vendorId: "9",
|
|
company: "New Co",
|
|
tech: "Pat",
|
|
techPhone: "555",
|
|
});
|
|
expect(patch.primaryDispatchStatus).toBe("");
|
|
expect(patch.vendorId).toBe("9");
|
|
|
|
const input = tableRowToClosabilityInput({
|
|
dispatcherId: "u1",
|
|
dispatcherName: "Alex",
|
|
company: patch.company ?? "",
|
|
vendorId: patch.vendorId ?? "",
|
|
tech: patch.tech ?? "",
|
|
completedDate: "2026-07-15",
|
|
woNumber: "20260623001",
|
|
pm: "HVAC PM",
|
|
docStatus: "Yes",
|
|
mediaCount: 1,
|
|
type: "PM",
|
|
primaryDispatchStatus: patch.primaryDispatchStatus,
|
|
} as WorkOrderTableRow);
|
|
expect(getClosabilityGaps(input)).not.toContain("Company");
|
|
});
|
|
});
|