From 470ad95208782f0c3cdd37098b81369c58551b65 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 2 Oct 2024 12:37:40 +0200 Subject: [PATCH] Run view tests --- .../src/api/routes/tests/search.spec.ts | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/packages/server/src/api/routes/tests/search.spec.ts b/packages/server/src/api/routes/tests/search.spec.ts index 86ae0acf9b..6ae5490fb2 100644 --- a/packages/server/src/api/routes/tests/search.spec.ts +++ b/packages/server/src/api/routes/tests/search.spec.ts @@ -34,6 +34,7 @@ import { Table, TableSchema, User, + ViewFieldMetadata, } from "@budibase/types" import _ from "lodash" import tk from "timekeeper" @@ -154,29 +155,33 @@ describe.each([ describe.each([ ["table", createTable], - // [ - // "view", - // async (schema: TableSchema, name?: string) => { - // const tableId = await createTable(schema, name) - // const view = await config.api.viewV2.create({ - // tableId: tableId, - // name: generator.guid(), - // schema: Object.keys(schema).reduce>( - // (viewSchema, fieldName) => { - // const field = schema[fieldName] - // viewSchema[fieldName] = { - // visible: field.visible ?? true, - // readonly: false, - // } - // return viewSchema - // }, - // {} - // ), - // }) - // return view.id - // }, - // ], - ])("from %s", (__, createSource) => { + [ + "view", + async (schema: TableSchema, name?: string) => { + const tableId = await createTable(schema, name) + const view = await config.api.viewV2.create({ + tableId: tableId, + name: generator.guid(), + schema: Object.keys(schema).reduce>( + (viewSchema, fieldName) => { + const field = schema[fieldName] + viewSchema[fieldName] = { + visible: field.visible ?? true, + readonly: false, + } + return viewSchema + }, + {} + ), + }) + return view.id + }, + ], + ])("from %s", (tableOrView, createSource) => { + if (isInMemory && tableOrView === "view") { + return + } + class SearchAssertion { constructor(private readonly query: SearchRowRequest) {}