1
0
Fork 0
mirror of synced 2024-07-07 15:25:52 +12:00

Test returning views

This commit is contained in:
Adria Navarro 2023-07-21 11:21:22 +02:00
parent 46cb7c7117
commit 5fa7972564

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", () => {