Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ifstep audit trail): fix of ifstep audit trail and context when we use nestedsteps #52

Merged
merged 5 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/ifElse.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class IfElse {
_addMeta(info) {
const [description, step] = info
step.description = description
step.context = this.context

if(this.context)
step.context = this.context

return step
}

Expand All @@ -26,13 +29,17 @@ class IfElse {
const thenStep = this._addMeta(thenInfo)
const elseStep = this._addMeta(elseInfo)

const ifRet = this._auditTrail.returnIf = await ifStep.run()
const ifRet = await ifStep.run()
this._auditTrail.returnIf = ifStep.auditTrail

let ret
if (ifRet && ifRet.isOk && ifRet.value === true) {
ret = this._auditTrail.returnThen = await thenStep.run()
ret = await thenStep.run()
this._auditTrail.returnThen = thenStep.auditTrail
}
else if (ifRet && ifRet.isOk && ifRet.value === false) {
ret = this._auditTrail.returnElse = await elseStep.run()
ret = await elseStep.run()
this._auditTrail.returnElse = elseStep.auditTrail
}
else
ret = this._auditTrail.returnIf = Err({ value: ifRet, msg: 'Invalid ifElse' })
Expand Down
Loading