fix tests oncemore

This commit is contained in:
Peter Clement 2024-01-11 15:41:41 +00:00
parent 021eb58ea7
commit 72c2f6577c
2 changed files with 6 additions and 25 deletions

View File

@ -21,14 +21,16 @@ describe("Test triggering an automation from another automation", () => {
let automation = serverLogAutomation() let automation = serverLogAutomation()
let newAutomation = await config.createAutomation(automation) let newAutomation = await config.createAutomation(automation)
const inputs: any = { automationId: newAutomation._id, timeout: 12000 } const inputs: any = {
automation: { automationId: newAutomation._id, timeout: 12000 },
}
const res = await setup.runStep(setup.actions.TRIGGER.stepId, inputs) const res = await setup.runStep(setup.actions.TRIGGER.stepId, inputs)
// Check if the SERVER_LOG step was successful // Check if the SERVER_LOG step was successful
expect(res.value[1].outputs.success).toBe(true) expect(res.value[1].outputs.success).toBe(true)
}) })
it("should fail gracefully if the automation id is incorrect", async () => { it("should fail gracefully if the automation id is incorrect", async () => {
const inputs: any = { automationId: null, timeout: 12000 } 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.stepId, inputs)
expect(res.success).toBe(false) expect(res.success).toBe(false)
}) })

View File

@ -192,30 +192,9 @@ export function serverLogAutomation(appId?: string): Automation {
LOOPING: true, LOOPING: true,
}, },
inputs: { inputs: {
text: "sdfsdf", text: "log statement",
},
schema: {
inputs: {
properties: {
text: {
type: AutomationIOType.STRING,
title: "Text to log",
},
},
required: ["text"],
},
outputs: {
properties: {
success: {
description: "Whether the action was successful",
},
message: {
description: "What was output",
},
},
required: ["success", "message"],
},
}, },
schema: BUILTIN_ACTION_DEFINITIONS.SERVER_LOG.schema,
id: "y8lkZbeSe", id: "y8lkZbeSe",
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
}, },