From 97957e96bd69755a1149c4a317fa36a68e6ac958 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 25 Jul 2023 15:35:48 +0200 Subject: [PATCH] Update test --- .../src/api/routes/tests/viewV2.spec.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index bf09026ec6..57429e36e5 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -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" })