Add safety tests

This commit is contained in:
Adria Navarro 2024-07-31 17:26:42 +02:00
parent c015f8d192
commit 788a16cf48
1 changed files with 23 additions and 0 deletions

View File

@ -123,6 +123,29 @@ describe.each([
body: basicTable(),
})
})
it("does not persist the row fields that are not on the table schema", async () => {
const table: SaveTableRequest = basicTable()
table.rows = [
{
name: "test-name",
description: "test-desc",
nonValid: "test-non-valid",
},
]
const res = await config.api.table.save(table)
const persistedRows = await config.api.row.search(res._id!)
expect(persistedRows.rows).toEqual([
expect.objectContaining({
name: "test-name",
description: "test-desc",
}),
])
expect(persistedRows.rows[0].nonValid).toBeUndefined()
})
})
describe("update", () => {