More tests

This commit is contained in:
Adria Navarro 2024-08-23 11:12:31 +02:00
parent a28114a01c
commit 02fdbae7ac
1 changed files with 9 additions and 8 deletions

View File

@ -2534,24 +2534,24 @@ describe.each([
}) })
it.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", "fetch",
async (rowId: string) => { async (row: Row) => {
const rows = await config.api.row.fetch(tableId) const rows = await config.api.row.fetch(tableId)
return rows.find(r => r._id === rowId) return rows.find(r => r._id === row._id)
}, },
], ],
[ [
"search", "search",
async (rowId: string) => { async (row: Row) => {
const { rows } = await config.api.row.search(tableId) 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", "from view",
async (rowId: string) => { async (row: Row) => {
const table = await config.api.table.get(tableId) const table = await config.api.table.get(tableId)
const view = await config.api.viewV2.create({ const view = await config.api.viewV2.create({
name: generator.guid(), name: generator.guid(),
@ -2562,9 +2562,10 @@ describe.each([
), ),
}) })
const { rows } = await config.api.viewV2.search(view.id) 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)", "can retrieve rows with populated relationships (via %s)",
async (__, retrieveDelegate) => { async (__, retrieveDelegate) => {
@ -2579,7 +2580,7 @@ describe.each([
relWithIllegalSchema: [otherRows[4]], relWithIllegalSchema: [otherRows[4]],
}) })
const retrieved = await retrieveDelegate(row._id!) const retrieved = await retrieveDelegate(row)
expect(retrieved).toEqual( expect(retrieved).toEqual(
expect.objectContaining({ expect.objectContaining({
title: row.title, title: row.title,