fix: canceling workflow reminders (#21416)
* fix deleting reminders * schedule reminders if iffy is disabled * fix unit test * clean up code --------- Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
1 parent
21a4711f07
commit
4ff366cd99
3 files changed
+89
-79
No files matched your search
@@ -5,7 +5,7 @@ import { describe, expect, it, vi, beforeEach } from "vitest";
|
||||
import { lockUser, LockReason } from "@calcom/lib/autoLock";
|
||||
import { scheduleWorkflowNotifications } from "@calcom/trpc/server/routers/viewer/workflows/util";
|
||||
|
||||
import { scanWorkflowBody } from "./scanWorkflowBody";
|
||||
import { scanWorkflowBody, iffyScanBody } from "./scanWorkflowBody";
|
||||
|
||||
vi.mock("@calcom/lib/autoLock", async (importActual) => {
|
||||
const actual = await importActual<typeof import("@calcom/lib/autoLock")>();
|
||||
@@ -19,6 +19,14 @@ vi.mock("@calcom/trpc/server/routers/viewer/workflows/util", () => ({
|
||||
scheduleWorkflowNotifications: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("./scanWorkflowBody", async (importActual) => {
|
||||
const actual = await importActual<typeof import("./scanWorkflowBody")>();
|
||||
return {
|
||||
...actual,
|
||||
iffyScanBody: vi.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
const mockWorkflowStep = {
|
||||
id: 1,
|
||||
reminderBody: "Test reminder body",
|
||||
@@ -58,7 +66,7 @@ describe("scanWorkflowBody", () => {
|
||||
|
||||
await scanWorkflowBody(payload);
|
||||
|
||||
expect(prismaMock.workflowStep.findMany).not.toHaveBeenCalled();
|
||||
expect(iffyScanBody).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should mark workflow step as safe if no reminder body", async () => {
|
||||
|
||||
Reference in new issue
Block a user