shoc-frontend-new/src/test/app/(protected)/workorders/reschedule-notify.test.ts
Arthur Bassi c71d9482ec feat(work-orders): align Schedule On clear with shared demotion path
Board Clear uses empty-week patch; slide-over Save derives Pending via mergeAutoSchedulePatch.
2026-09-09 15:44:49 -03:00

33 lines
939 B
TypeScript

import { beforeEach, describe, expect, it, vi } from "vitest";
import { weekMoveNotify } from "@/app/(protected)/workorders/_components/list/table/reschedule-notify";
const { toast } = vi.hoisted(() => {
const notify = Object.assign(
vi.fn((_content: unknown, _options?: unknown) => 1),
{
dismiss: vi.fn(),
},
);
return { toast: notify };
});
vi.mock("react-toastify", () => ({ toast }));
describe("weekMoveNotify", () => {
beforeEach(() => {
toast.mockClear();
toast.dismiss.mockClear();
});
it("uses the AAP Unscheduled message and Advanced Filters action when clearing", () => {
weekMoveNotify("", { onNavigate: vi.fn() });
const content = toast.mock.calls[0][0] as {
props: { message: string; linkLabel: string };
};
expect(content.props).toMatchObject({
message: "Work order moved to Unscheduled.",
linkLabel: "View in Advanced Filters.",
});
});
});