1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00

Update test

This commit is contained in:
Adria Navarro 2023-07-25 15:35:48 +02:00
parent 2412056292
commit 97957e96bd

View file

@ -94,6 +94,27 @@ describe("/v2/views", () => {
view = await config.api.viewV2.create({ name: "View A" })
})
it("can update an existing view data", async () => {
const tableId = config.table!._id!
await config.api.viewV2.update({
...view,
query: { equal: { newField: "thatValue" } },
})
expect(await config.api.table.get(tableId)).toEqual({
...config.table,
views: {
[view.name]: {
...view,
query: { equal: { newField: "thatValue" } },
schema: expect.anything(),
},
},
_rev: expect.any(String),
updatedAt: expect.any(String),
})
})
it("can update an existing view name", async () => {
const tableId = config.table!._id!
await config.api.viewV2.update({ ...view, name: "View B" })