From 8a9e87ea6f9dbe4142a6c6e41fffc6ad2fa3174b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 27 Sep 2023 17:08:29 +0200 Subject: [PATCH] Add extra tests --- .../server/src/api/routes/tests/row.spec.ts | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 38aa1294f4..41571a51d9 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -26,7 +26,6 @@ import { mocks, structures, } from "@budibase/backend-core/tests" -import { async } from "validate.js" const timestamp = new Date("2023-01-26T11:48:57.597Z").toISOString() tk.freeze(timestamp) @@ -1658,5 +1657,36 @@ describe.each([ _rev: expect.any(String), }) }) + + it("can wipe an existing populated BB references in row", async () => { + const [user1, user2] = [ + await config.createUser(), + await config.createUser(), + ] + + const rowData = { + ...basicRow(tableId), + name: generator.name(), + description: generator.name(), + users: [user1, user2], + } + const row = await config.api.row.save(tableId, rowData) + + const updatedRow = await config.api.row.save(tableId, { + ...row, + user: null, + users: null, + }) + expect(updatedRow).toEqual({ + name: rowData.name, + description: rowData.description, + type: "row", + tableId, + user: null, + users: null, + _id: row._id, + _rev: expect.any(String), + }) + }) }) })