From a03094db330b8158c2b1be4ea1c3c46844c84e7f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 23 Jul 2024 12:21:52 +0200 Subject: [PATCH] Use 422 instead of 400 trying to delete row action automations --- packages/server/src/api/controllers/automation.ts | 2 +- packages/server/src/api/routes/tests/automation.spec.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/automation.ts b/packages/server/src/api/controllers/automation.ts index ab5b6e3fd7..6177868303 100644 --- a/packages/server/src/api/controllers/automation.ts +++ b/packages/server/src/api/controllers/automation.ts @@ -97,7 +97,7 @@ export async function destroy(ctx: UserCtx) { const automation = await sdk.automations.get(ctx.params.id) if (coreSdk.automations.isRowAction(automation)) { - ctx.throw("Row actions cannot be deleted", 400) + ctx.throw("Row actions automations cannot be deleted", 422) } ctx.body = await sdk.automations.remove(automationId, ctx.params.rev) diff --git a/packages/server/src/api/routes/tests/automation.spec.ts b/packages/server/src/api/routes/tests/automation.spec.ts index 8fccb32299..990828dcde 100644 --- a/packages/server/src/api/routes/tests/automation.spec.ts +++ b/packages/server/src/api/routes/tests/automation.spec.ts @@ -433,7 +433,10 @@ describe("/automations", () => { .delete(`/api/automations/${automation._id}/${automation._rev}`) .set(config.defaultHeaders()) .expect("Content-Type", /json/) - .expect(400, { message: "Row actions cannot be deleted", status: 400 }) + .expect(422, { + message: "Row actions automations cannot be deleted", + status: 422, + }) expect(events.automation.deleted).not.toHaveBeenCalled() })