From 021eb58ea7b08997528ff689c2b6e7ddf9bb355c Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 11 Jan 2024 14:13:59 +0000 Subject: [PATCH] fix tests --- .../src/automations/tests/trigger.spec.ts | 4 ++- .../server/src/tests/utilities/structures.ts | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/packages/server/src/automations/tests/trigger.spec.ts b/packages/server/src/automations/tests/trigger.spec.ts index e8a2cc9345..651d36bf4c 100644 --- a/packages/server/src/automations/tests/trigger.spec.ts +++ b/packages/server/src/automations/tests/trigger.spec.ts @@ -2,6 +2,7 @@ jest.spyOn(global.console, "error") import * as setup from "./utilities" import * as automation from "../index" +import { serverLogAutomation } from "../../tests/utilities/structures" describe("Test triggering an automation from another automation", () => { let config = setup.getConfig() @@ -17,7 +18,8 @@ describe("Test triggering an automation from another automation", () => { }) it("should trigger an other server log automation", async () => { - let newAutomation = await config.createAutomation() + let automation = serverLogAutomation() + let newAutomation = await config.createAutomation(automation) const inputs: any = { automationId: newAutomation._id, timeout: 12000 } const res = await setup.runStep(setup.actions.TRIGGER.stepId, inputs) diff --git a/packages/server/src/tests/utilities/structures.ts b/packages/server/src/tests/utilities/structures.ts index 41a555a0d9..eef97b1da8 100644 --- a/packages/server/src/tests/utilities/structures.ts +++ b/packages/server/src/tests/utilities/structures.ts @@ -124,6 +124,38 @@ export function newAutomation({ steps, trigger }: any = {}) { } export function basicAutomation(appId?: string): Automation { + return { + name: "My Automation", + screenId: "kasdkfldsafkl", + live: true, + uiTree: {}, + definition: { + trigger: { + stepId: AutomationTriggerStepId.APP, + name: "test", + tagline: "test", + icon: "test", + description: "test", + type: AutomationStepType.TRIGGER, + id: "test", + inputs: {}, + schema: { + inputs: { + properties: {}, + }, + outputs: { + properties: {}, + }, + }, + }, + steps: [], + }, + type: "automation", + appId: appId!, + } +} + +export function serverLogAutomation(appId?: string): Automation { return { name: "My Automation", screenId: "kasdkfldsafkl",