mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-05 04:52:07 +00:00
28 lines
1.1 KiB
TypeScript
28 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");
|
||
|
|
});
|
||
|
|
});
|