Adding more tests

This commit is contained in:
Adria Navarro 2023-01-18 16:48:18 +00:00
parent 4ae43f1a96
commit 6a1589ba64
1 changed files with 16 additions and 0 deletions

View File

@ -128,5 +128,21 @@ describe("row api", () => {
expect(res.body.data).toEqual(expect.objectContaining(rowData))
})
test("Given than a table have a multiple rows, a single row can be retrieved successfully", async () => {
await Promise.all(Array(5).map(() => config.createRow(createRandomRow())))
const rowData = createRandomRow()
const row = await config.createRow(rowData)
await Promise.all(Array(2).map(() => config.createRow(createRandomRow())))
const res = await makeRequest(
"get",
`/tables/${postgresTable._id}/rows/${row._id}`
)
expect(res.status).toBe(200)
expect(res.body.data).toEqual(expect.objectContaining(rowData))
})
})
})