From 812afdb85eaf5b82583d46f0f1e28652e9906771 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 17 Jul 2024 16:28:46 +0200 Subject: [PATCH] Fix tests (breaking because of mutating objects...) --- packages/server/src/api/routes/tests/automation.spec.ts | 9 +++------ packages/server/src/tests/utilities/structures.ts | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/server/src/api/routes/tests/automation.spec.ts b/packages/server/src/api/routes/tests/automation.spec.ts index 8cbd14d8b3..80ef08f4c9 100644 --- a/packages/server/src/api/routes/tests/automation.spec.ts +++ b/packages/server/src/api/routes/tests/automation.spec.ts @@ -267,8 +267,7 @@ describe("/automations", () => { } it("updates a automations name", async () => { - let automation = newAutomation() - await config.createAutomation(automation) + const automation = await config.createAutomation(newAutomation()) automation.name = "Updated Name" jest.clearAllMocks() @@ -294,8 +293,7 @@ describe("/automations", () => { }) it("updates a automations name using POST request", async () => { - let automation = newAutomation() - await config.createAutomation(automation) + const automation = await config.createAutomation(newAutomation()) automation.name = "Updated Name" jest.clearAllMocks() @@ -392,8 +390,7 @@ describe("/automations", () => { describe("fetch", () => { it("return all the automations for an instance", async () => { await clearAllAutomations(config) - const autoConfig = basicAutomation() - await config.createAutomation(autoConfig) + const autoConfig = await config.createAutomation(basicAutomation()) const res = await request .get(`/api/automations`) .set(config.defaultHeaders()) diff --git a/packages/server/src/tests/utilities/structures.ts b/packages/server/src/tests/utilities/structures.ts index e65ce12873..e00130c617 100644 --- a/packages/server/src/tests/utilities/structures.ts +++ b/packages/server/src/tests/utilities/structures.ts @@ -159,7 +159,7 @@ export function automationTrigger( } export function newAutomation({ steps, trigger }: any = {}) { - const automation: any = basicAutomation() + const automation = basicAutomation() if (trigger) { automation.definition.trigger = trigger