From 61b34b3ead7a30d2f1d504ece3388659486df9be Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 16 Jan 2024 16:58:13 +0000 Subject: [PATCH] mock out pro call --- packages/server/__mocks__/@budibase/pro.ts | 12 ++++++++++++ .../automations/tests/triggerAutomationRun.spec.ts | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 packages/server/__mocks__/@budibase/pro.ts diff --git a/packages/server/__mocks__/@budibase/pro.ts b/packages/server/__mocks__/@budibase/pro.ts new file mode 100644 index 0000000000..3f0c35d725 --- /dev/null +++ b/packages/server/__mocks__/@budibase/pro.ts @@ -0,0 +1,12 @@ +const actual = jest.requireActual("@budibase/pro") +const pro = { + ...actual, + features: { + ...actual.features, + isTriggerAutomationRunEnabled: () => { + return true + }, + }, +} + +export = pro diff --git a/packages/server/src/automations/tests/triggerAutomationRun.spec.ts b/packages/server/src/automations/tests/triggerAutomationRun.spec.ts index a9a85b4a84..f8cf647e79 100644 --- a/packages/server/src/automations/tests/triggerAutomationRun.spec.ts +++ b/packages/server/src/automations/tests/triggerAutomationRun.spec.ts @@ -34,7 +34,10 @@ describe("Test triggering an automation from another automation", () => { it("should fail gracefully if the automation id is incorrect", async () => { const inputs: any = { automation: { automationId: null, timeout: 12000 } } - const res = await setup.runStep(setup.actions.TRIGGER.stepId, inputs) + const res = await setup.runStep( + setup.actions.TRIGGER_AUTOMATION_RUN.stepId, + inputs + ) expect(res.success).toBe(false) }) })