From 9ff3d8cf77dc00fe23726c8916c82d8360e69af2 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 11 Jul 2024 17:14:14 +0200 Subject: [PATCH] Add extra tests --- .../src/api/routes/tests/rowAction.spec.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/server/src/api/routes/tests/rowAction.spec.ts b/packages/server/src/api/routes/tests/rowAction.spec.ts index e53d39b553..7a3bc26068 100644 --- a/packages/server/src/api/routes/tests/rowAction.spec.ts +++ b/packages/server/src/api/routes/tests/rowAction.spec.ts @@ -224,5 +224,31 @@ describe("/rowsActions", () => { }) ) }) + + it("throws Bad Request when trying to update by a non-existing id", async () => { + await createRowAction(tableId, createRowActionRequest()) + + await config.api.rowAction.update( + tableId, + generator.guid(), + createRowActionRequest(), + { status: 400 } + ) + }) + + it("throws Bad Request when trying to update by a via another table id", async () => { + const otherTable = await config.api.table.save( + setup.structures.basicTable() + ) + await createRowAction(otherTable._id!, createRowActionRequest()) + + const action = await createRowAction(tableId, createRowActionRequest()) + await config.api.rowAction.update( + otherTable._id!, + action.actionId, + createRowActionRequest(), + { status: 400 } + ) + }) }) })