mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-02 09:43:12 +00:00
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.
27 lines
1.1 KiB
TypeScript
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");
|
|
});
|
|
});
|