From 8a9e86852756594285f418bbc5c16ed3864fb78a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 28 Aug 2024 13:26:23 +0200 Subject: [PATCH] Move test to right describe --- .../src/api/routes/tests/viewV2.spec.ts | 87 ++++++++++--------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index 476d2f4d60..d6546f8e03 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -978,49 +978,6 @@ describe.each([ }) }) - describe("read", () => { - let view: ViewV2 - - beforeAll(async () => { - table = await config.api.table.save( - saveTableRequest({ - schema: { - Country: { - type: FieldType.STRING, - name: "Country", - }, - Story: { - type: FieldType.STRING, - name: "Story", - }, - }, - }) - ) - - view = await config.api.viewV2.create({ - tableId: table._id!, - name: generator.guid(), - schema: { - id: { visible: true }, - Country: { - visible: true, - }, - }, - }) - }) - - it("views have extra data trimmed", async () => { - let row = await config.api.row.save(view.id, { - Country: "Aussy", - Story: "aaaaa", - }) - - row = await config.api.row.get(table._id!, row._id!) - expect(row.Story).toBeUndefined() - expect(row.Country).toEqual("Aussy") - }) - }) - describe("row operations", () => { let table: Table, view: ViewV2 beforeEach(async () => { @@ -1194,6 +1151,50 @@ describe.each([ }) }) + describe("read", () => { + let view: ViewV2 + let table: Table + + beforeAll(async () => { + table = await config.api.table.save( + saveTableRequest({ + schema: { + Country: { + type: FieldType.STRING, + name: "Country", + }, + Story: { + type: FieldType.STRING, + name: "Story", + }, + }, + }) + ) + + view = await config.api.viewV2.create({ + tableId: table._id!, + name: generator.guid(), + schema: { + id: { visible: true }, + Country: { + visible: true, + }, + }, + }) + }) + + it("views have extra data trimmed", async () => { + let row = await config.api.row.save(view.id, { + Country: "Aussy", + Story: "aaaaa", + }) + + row = await config.api.row.get(table._id!, row._id!) + expect(row.Story).toBeUndefined() + expect(row.Country).toEqual("Aussy") + }) + }) + describe("search", () => { it("returns empty rows from view when no schema is passed", async () => { const rows = await Promise.all(