From af42e789ff4cbbae37f63b2991a595bc2a947317 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 19 Jan 2023 17:28:42 +0000 Subject: [PATCH] Test delete multiple --- .../src/integration-test/postgres.spec.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/server/src/integration-test/postgres.spec.ts b/packages/server/src/integration-test/postgres.spec.ts index bb5d31bd90..2b49d9a746 100644 --- a/packages/server/src/integration-test/postgres.spec.ts +++ b/packages/server/src/integration-test/postgres.spec.ts @@ -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", () => {