Add extra tests

This commit is contained in:
Adria Navarro 2023-09-27 17:08:29 +02:00
parent a87e3dd0fc
commit 8a9e87ea6f
1 changed files with 31 additions and 1 deletions

View File

@ -26,7 +26,6 @@ import {
mocks, mocks,
structures, structures,
} from "@budibase/backend-core/tests" } from "@budibase/backend-core/tests"
import { async } from "validate.js"
const timestamp = new Date("2023-01-26T11:48:57.597Z").toISOString() const timestamp = new Date("2023-01-26T11:48:57.597Z").toISOString()
tk.freeze(timestamp) tk.freeze(timestamp)
@ -1658,5 +1657,36 @@ describe.each([
_rev: expect.any(String), _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),
})
})
}) })
}) })