fix tests

This commit is contained in:
Peter Clement 2024-01-11 14:13:59 +00:00
parent 9c22bee324
commit 021eb58ea7
2 changed files with 35 additions and 1 deletions

View File

@ -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)

View File

@ -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",