shoc-frontend-new/src/test/domain/work-orders/utils/should-notify-cross-week.test.ts

22 lines
944 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { describe, expect, it } from "vitest";
import { shouldNotifyCrossWeek } from "@/domain/work-orders/utils/should-notify-cross-week";
describe("shouldNotifyCrossWeek", () => {
const activeMonday = "2026-07-13"; // Mon Jul 13 – Fri Jul 17
it("returns false when date is in the active week", () => {
expect(shouldNotifyCrossWeek("2026-07-15", activeMonday)).toBe(false);
expect(shouldNotifyCrossWeek("2026-07-13", activeMonday)).toBe(false);
expect(shouldNotifyCrossWeek("2026-07-17", activeMonday)).toBe(false);
});
it("returns true when date is in another week", () => {
expect(shouldNotifyCrossWeek("2026-07-20", activeMonday)).toBe(true);
expect(shouldNotifyCrossWeek("2026-07-06", activeMonday)).toBe(true);
});
it("returns false for empty inputs", () => {
expect(shouldNotifyCrossWeek("", activeMonday)).toBe(false);
expect(shouldNotifyCrossWeek("2026-07-20", "")).toBe(false);
});
});