Fix automation route tests, address Adri's comments.
This commit is contained in:
parent
8a84a70608
commit
892879f0e6
|
@ -1094,7 +1094,7 @@ const automationActions = (store: AutomationStore) => ({
|
|||
branchLeft: async (
|
||||
pathTo: Array<any>,
|
||||
automation: Automation,
|
||||
block: AutomationStep
|
||||
block: BranchStep
|
||||
) => {
|
||||
const update = store.actions.shiftBranch(pathTo, block)
|
||||
if (update) {
|
||||
|
@ -1117,7 +1117,7 @@ const automationActions = (store: AutomationStore) => ({
|
|||
branchRight: async (
|
||||
pathTo: Array<BranchPath>,
|
||||
automation: Automation,
|
||||
block: AutomationStep
|
||||
block: BranchStep
|
||||
) => {
|
||||
const update = store.actions.shiftBranch(pathTo, block, 1)
|
||||
if (update) {
|
||||
|
@ -1137,8 +1137,8 @@ const automationActions = (store: AutomationStore) => ({
|
|||
* @param {Number} direction - the direction of the swap. Defaults to -1 for left, add 1 for right
|
||||
* @returns
|
||||
*/
|
||||
shiftBranch: (pathTo: Array<any>, block: AutomationStep, direction = -1) => {
|
||||
let newBlock = cloneDeep(block) as BranchStep
|
||||
shiftBranch: (pathTo: Array<any>, block: BranchStep, direction = -1) => {
|
||||
let newBlock = cloneDeep(block)
|
||||
const branchPath = pathTo.at(-1)
|
||||
const targetIdx = branchPath.branchIdx
|
||||
|
||||
|
|
|
@ -519,11 +519,6 @@ describe("/automations", () => {
|
|||
|
||||
describe("fetch", () => {
|
||||
it("return all the automations for an instance", async () => {
|
||||
const fetchResponse = await config.api.automation.fetch()
|
||||
for (const auto of fetchResponse.automations) {
|
||||
await config.api.automation.delete(auto)
|
||||
}
|
||||
|
||||
const { automation: automation1 } = await config.api.automation.post(
|
||||
newAutomation()
|
||||
)
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
import { LoopStepType, UserBindings } from "@budibase/types"
|
||||
import {
|
||||
AutomationStepResult,
|
||||
AutomationStepResultOutputs,
|
||||
AutomationTriggerResult,
|
||||
AutomationTriggerResultOutputs,
|
||||
LoopStepType,
|
||||
UserBindings,
|
||||
} from "@budibase/types"
|
||||
|
||||
export interface LoopInput {
|
||||
option: LoopStepType
|
||||
|
@ -14,10 +21,10 @@ export interface TriggerOutput {
|
|||
}
|
||||
|
||||
export interface AutomationContext {
|
||||
trigger: any
|
||||
steps: any[]
|
||||
stepsById: Record<string, any>
|
||||
stepsByName: Record<string, any>
|
||||
trigger: AutomationTriggerResultOutputs
|
||||
steps: [AutomationTriggerResultOutputs, ...AutomationStepResultOutputs[]]
|
||||
stepsById: Record<string, AutomationStepResultOutputs>
|
||||
stepsByName: Record<string, AutomationStepResultOutputs>
|
||||
env?: Record<string, string>
|
||||
user?: UserBindings
|
||||
settings?: {
|
||||
|
|
|
@ -208,11 +208,14 @@ export interface AutomationStepResult {
|
|||
outputs: AutomationStepResultOutputs
|
||||
}
|
||||
|
||||
export type AutomationTriggerResultInputs = Record<string, any>
|
||||
export type AutomationTriggerResultOutputs = Record<string, any>
|
||||
|
||||
export interface AutomationTriggerResult {
|
||||
id: string
|
||||
stepId: AutomationTriggerStepId
|
||||
inputs?: Record<string, any> | null
|
||||
outputs: Record<string, any>
|
||||
inputs?: AutomationTriggerResultInputs | null
|
||||
outputs: AutomationTriggerResultOutputs
|
||||
}
|
||||
|
||||
export interface AutomationResults {
|
||||
|
|
Loading…
Reference in New Issue