From 02fdbae7ac84071a484f47b5a511f548c4814fed Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 23 Aug 2024 11:12:31 +0200 Subject: [PATCH] More tests --- .../server/src/api/routes/tests/row.spec.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 0484fcd81e..2781f58823 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -2534,24 +2534,24 @@ describe.each([ }) it.each([ - ["get row", (rowId: string) => config.api.row.get(tableId, rowId)], + ["get row", (row: Row) => config.api.row.get(tableId, row._id!)], [ "fetch", - async (rowId: string) => { + async (row: Row) => { const rows = await config.api.row.fetch(tableId) - return rows.find(r => r._id === rowId) + return rows.find(r => r._id === row._id) }, ], [ "search", - async (rowId: string) => { + async (row: Row) => { const { rows } = await config.api.row.search(tableId) - return rows.find(r => r._id === rowId) + return rows.find(r => r._id === row._id) }, ], [ "from view", - async (rowId: string) => { + async (row: Row) => { const table = await config.api.table.get(tableId) const view = await config.api.viewV2.create({ name: generator.guid(), @@ -2562,9 +2562,10 @@ describe.each([ ), }) const { rows } = await config.api.viewV2.search(view.id) - return rows.find(r => r._id === rowId) + return rows.find(r => r._id === row._id!) }, ], + ["from original saved row", (row: Row) => row], ])( "can retrieve rows with populated relationships (via %s)", async (__, retrieveDelegate) => { @@ -2579,7 +2580,7 @@ describe.each([ relWithIllegalSchema: [otherRows[4]], }) - const retrieved = await retrieveDelegate(row._id!) + const retrieved = await retrieveDelegate(row) expect(retrieved).toEqual( expect.objectContaining({ title: row.title,