From bc3658e2cb7452a4dd78c7b6d01dac172436af2d Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 2 Dec 2024 15:12:27 +0000 Subject: [PATCH] Adding fix for build issue. --- packages/server/src/api/controllers/automation.ts | 1 - packages/server/src/automations/tests/loop.spec.ts | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/server/src/api/controllers/automation.ts b/packages/server/src/api/controllers/automation.ts index d13b0d3191..c843dca89b 100644 --- a/packages/server/src/api/controllers/automation.ts +++ b/packages/server/src/api/controllers/automation.ts @@ -9,7 +9,6 @@ import { App, Automation, AutomationActionStepId, - AutomationResults, UserCtx, DeleteAutomationResponse, FetchAutomationResponse, diff --git a/packages/server/src/automations/tests/loop.spec.ts b/packages/server/src/automations/tests/loop.spec.ts index 372c3855b3..2199a2a3a0 100644 --- a/packages/server/src/automations/tests/loop.spec.ts +++ b/packages/server/src/automations/tests/loop.spec.ts @@ -3,7 +3,7 @@ import * as triggers from "../triggers" import { loopAutomation } from "../../tests/utilities/structures" import { context } from "@budibase/backend-core" import * as setup from "./utilities" -import { Table, LoopStepType } from "@budibase/types" +import { Table, LoopStepType, AutomationResults } from "@budibase/types" import * as loopUtils from "../loopUtils" import { LoopInput } from "../../definitions/automations" @@ -20,15 +20,19 @@ describe("Attempt to run a basic loop automation", () => { afterAll(setup.afterAll) - async function runLoop(loopOpts?: LoopInput) { + async function runLoop(loopOpts?: LoopInput): Promise { const appId = config.getAppId() return await context.doInAppContext(appId, async () => { const params = { fields: { appId } } - return await triggers.externalTrigger( + const result = await triggers.externalTrigger( loopAutomation(table._id!, loopOpts), params, { getResponses: true } ) + if ("outputs" in result && !result.outputs.success) { + throw new Error("Unable to proceed - failed to return anything.") + } + return result as AutomationResults }) }