1
0
Fork 0
mirror of synced 2024-09-20 19:33:10 +12:00

Use 422 instead of 400 trying to delete row action automations

This commit is contained in:
Adria Navarro 2024-07-23 12:21:52 +02:00
parent af0b69e8b6
commit a03094db33
2 changed files with 5 additions and 2 deletions

View file

@ -97,7 +97,7 @@ export async function destroy(ctx: UserCtx<void, DeleteAutomationResponse>) {
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)

View file

@ -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()
})