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

23 lines
944 B
TypeScript
Raw Normal View History

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);
});
});