shoc-frontend-new/src/test/domain/work-orders/utils/completion-doc-service-title.test.ts
Arthur Bassi 3004d039aa fix(work-orders): address SH-116 CompDoc review blockers
Gate CompDoc on selected service, use real pm titles only,
make Address editable via location update, and wire media
to the board API with categories instead of blob state.
2026-07-30 09:04:03 -03:00

27 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { hasCompletionDocService } from "@/domain/work-orders/utils/completion-doc-service-gate";
import { serviceTitle } from "@/domain/work-orders/utils/completion-doc-service-title";
describe("completion doc service gate", () => {
it("rejects empty or whitespace-only pm", () => {
expect(hasCompletionDocService("")).toBe(false);
expect(hasCompletionDocService(" ")).toBe(false);
expect(hasCompletionDocService(null)).toBe(false);
expect(hasCompletionDocService(undefined)).toBe(false);
});
it("accepts a selected service", () => {
expect(hasCompletionDocService("HVAC Inspection")).toBe(true);
});
});
describe("completion doc service title", () => {
it("uses the selected service without fabricating a frequency cycle", () => {
expect(serviceTitle({ pm: "HVAC Inspection" })).toBe("Amer-Building HVAC Inspection");
expect(serviceTitle({ pm: "HVAC Inspection" })).not.toMatch(/Week/);
});
it("maps known service phrases without hashing the work-order number", () => {
expect(serviceTitle({ pm: "Scrubber Pit" })).toBe("Amer-Building Scrubber Pit Augering");
});
});