Test returning views

This commit is contained in:
Adria Navarro 2023-07-21 11:21:22 +02:00
parent 46cb7c7117
commit 5fa7972564
1 changed files with 26 additions and 0 deletions

View File

@ -209,6 +209,32 @@ describe("/tables", () => {
url: `/api/tables`,
})
})
it("should fetch views", async () => {
const tableId = config.table!._id!
const views = [
await config.api.viewV2.create({ tableId }),
await config.api.viewV2.create({ tableId }),
]
const res = await request
.get(`/api/tables`)
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
expect(res.body).toEqual(
expect.arrayContaining([
expect.objectContaining({
_id: tableId,
views: views.reduce((p, c) => {
p[c.name] = c
return p
}, {} as any),
}),
])
)
})
})
describe("indexing", () => {