Add view tests

This commit is contained in:
Adria Navarro 2024-08-09 11:39:58 +02:00
parent 3acc9bde45
commit 331e8eb7be
1 changed files with 22 additions and 0 deletions

View File

@ -1602,6 +1602,28 @@ describe.each([
})
expect(response.rows).toHaveLength(0)
})
it("queries the row api passing the view fields only", async () => {
const searchSpy = jest.spyOn(sdk.rows, "search")
const view = await config.api.viewV2.create({
tableId: table._id!,
name: generator.guid(),
schema: {
id: { visible: true },
one: { visible: false },
},
})
await config.api.viewV2.search(view.id, { query: {} })
expect(searchSpy).toHaveBeenCalledTimes(1)
expect(searchSpy).toHaveBeenCalledWith(
expect.objectContaining({
fields: ["id"],
})
)
})
})
describe("permissions", () => {