1
0
Fork 0
mirror of synced 2024-09-19 18:59:06 +12:00

re-add branch step to outputs

This commit is contained in:
Peter Clement 2024-09-03 11:10:30 +01:00
parent 66fdf03398
commit 56641e06c3
2 changed files with 17 additions and 4 deletions

View file

@ -64,7 +64,7 @@ describe("Automation Scenarios", () => {
})
.run()
expect(results.steps[2].outputs.message).toContain("Branch 1.1")
expect(results.steps[4].outputs.message).toContain("Branch 1.1")
})
it("should execute correct branch based on string equality", async () => {
@ -92,7 +92,7 @@ describe("Automation Scenarios", () => {
})
.run()
expect(results.steps[0].outputs.message).toContain("Active user")
expect(results.steps[1].outputs.message).toContain("Active user")
})
it("should handle multiple conditions with AND operator", async () => {
@ -124,7 +124,7 @@ describe("Automation Scenarios", () => {
})
.run()
expect(results.steps[0].outputs.message).toContain("Active admin user")
expect(results.steps[1].outputs.message).toContain("Active admin user")
})
it("should handle multiple conditions with OR operator", async () => {
@ -162,7 +162,7 @@ describe("Automation Scenarios", () => {
})
.run()
expect(results.steps[0].outputs.message).toContain("Special user")
expect(results.steps[1].outputs.message).toContain("Special user")
})
})

View file

@ -461,6 +461,19 @@ class Orchestrator {
for (const branch of branches) {
const condition = await this.evaluateBranchCondition(branch.condition)
if (condition) {
let branchStatus = {
status: `${branch.name} branch taken`,
success: true,
}
this.updateExecutionOutput(
branchStep.id,
branchStep.stepId,
branchStep.inputs,
branchStatus
)
this.context.steps[this.context.steps.length] = branchStatus
const branchSteps = children?.[branch.name] || []
await this.executeSteps(branchSteps)
break