test and pr comments

This commit is contained in:
Peter Clement 2024-01-05 16:12:31 +00:00
parent 724eacdc72
commit e99a7672a7
5 changed files with 73 additions and 4 deletions

View File

@ -155,7 +155,6 @@ const automationActions = store => ({
await store.actions.save(newAutomation) await store.actions.save(newAutomation)
}, },
test: async (automation, testData) => { test: async (automation, testData) => {
console.log(testData)
const result = await API.testAutomation({ const result = await API.testAutomation({
automationId: automation?._id, automationId: automation?._id,
testData, testData,

View File

@ -19,7 +19,7 @@
export let lastStep export let lastStep
let syncAutomationsEnabled = $licensing.syncAutomationsEnabled let syncAutomationsEnabled = $licensing.syncAutomationsEnabled
let triggerAutomationsEnabled = true let triggerAutomationsEnabled = $licensing.triggerAutomationsEnabled
let collectBlockAllowedSteps = [TriggerStepID.APP, TriggerStepID.WEBHOOK] let collectBlockAllowedSteps = [TriggerStepID.APP, TriggerStepID.WEBHOOK]
let selectedAction let selectedAction
let actionVal let actionVal

View File

@ -105,7 +105,6 @@ export async function getActionDefinitions() {
/* istanbul ignore next */ /* istanbul ignore next */
export async function getAction(stepId: string) { export async function getAction(stepId: string) {
console.log(stepId)
if (ACTION_IMPLS[stepId] != null) { if (ACTION_IMPLS[stepId] != null) {
return ACTION_IMPLS[stepId] return ACTION_IMPLS[stepId]
} }

View File

@ -0,0 +1,33 @@
jest.spyOn(global.console, "error")
import * as setup from "./utilities"
import * as automation from "../index"
describe("Test triggering an automation from another automation", () => {
let config = setup.getConfig()
beforeAll(async () => {
await automation.init()
await config.init()
})
afterAll(async () => {
await automation.shutdown()
setup.afterAll()
})
it("should trigger an other server log automation", async () => {
let newAutomation = await config.createAutomation()
const inputs: any = { automationId: newAutomation._id, timeout: 12000 }
const res = await setup.runStep(setup.actions.TRIGGER.stepId, inputs)
// Check if the SERVER_LOG step was successful
expect(res.value[1].outputs.success).toBe(true)
})
it("should fail gracefully if the automation id is incorrect", async () => {
const inputs: any = { automationId: null, timeout: 12000 }
const res = await setup.runStep(setup.actions.TRIGGER.stepId, inputs)
expect(res.success).toBe(false)
})
})

View File

@ -146,7 +146,45 @@ export function basicAutomation(appId?: string): Automation {
}, },
}, },
}, },
steps: [], steps: [
{
stepId: AutomationActionStepId.SERVER_LOG,
name: "Backend log",
tagline: "Console log a value in the backend",
icon: "Monitoring",
description: "Logs the given text to the server (using console.log)",
internal: true,
features: {
LOOPING: true,
},
inputs: {
text: "sdfsdf",
},
schema: {
inputs: {
properties: {
text: {
type: "string",
title: "Text to log",
},
},
required: ["text"],
},
outputs: {
properties: {
success: {
description: "Whether the action was successful",
},
message: {
description: "What was output",
},
},
required: ["success", "message"],
},
},
id: "y8lkZbeSe",
},
],
}, },
type: "automation", type: "automation",
appId: appId!, appId: appId!,