Test delete multiple

This commit is contained in:
Adria Navarro 2023-01-19 17:28:42 +00:00
parent bcfb0f3727
commit af42e789ff
1 changed files with 19 additions and 1 deletions

View File

@ -224,7 +224,25 @@ describe("row api - postgres", () => {
)
})
// TODO: delete multiple rows
test("Given than multiple rows exist, multiple rows can be removed", async () => {
const numberOfInitialRows = 5
let rows = _.sampleSize(await populateRows(numberOfInitialRows), 3)!.map(
x => x.row
)
const res = await deleteRow(postgresTable._id, { rows })
expect(res.status).toBe(200)
const persistedRows = await config.getRows(postgresTable._id!)
expect(persistedRows).toHaveLength(numberOfInitialRows - 3)
for (const row of rows) {
expect(persistedRows).not.toContain(
expect.objectContaining({ _id: row._id })
)
}
})
})
describe("retrieve a row", () => {