mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-04 21:52:08 +00:00
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
|
|
import { describe, expect, it } from "vitest";
|
||
|
|
import {
|
||
|
|
formatSeverityEscalationToast,
|
||
|
|
shouldAnnounceSeverityEscalation,
|
||
|
|
} from "@/domain/work-orders/utils/severity-escalation";
|
||
|
|
|
||
|
|
describe("shouldAnnounceSeverityEscalation", () => {
|
||
|
|
it("announces when severity newly enters SEV 1", () => {
|
||
|
|
expect(shouldAnnounceSeverityEscalation(3, 1)).toBe(true);
|
||
|
|
expect(shouldAnnounceSeverityEscalation(null, 1)).toBe(true);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("does not announce a re-save of the same critical severity", () => {
|
||
|
|
expect(shouldAnnounceSeverityEscalation(1, 1)).toBe(false);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("does not announce a de-escalation out of SEV 1/2", () => {
|
||
|
|
expect(shouldAnnounceSeverityEscalation(2, 3)).toBe(false);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("does not announce SEV 2 to SEV 1 (already critical)", () => {
|
||
|
|
expect(shouldAnnounceSeverityEscalation(2, 1)).toBe(false);
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
describe("formatSeverityEscalationToast", () => {
|
||
|
|
it("matches the AAP warning copy", () => {
|
||
|
|
expect(formatSeverityEscalationToast("00000024965", 1)).toBe(
|
||
|
|
"WO #00000024965 escalated to SEV 1.",
|
||
|
|
);
|
||
|
|
});
|
||
|
|
});
|