From f1e90b8b016d81b0a68f1a8a69dca64a0faafac0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 26 Jan 2024 11:24:32 +0100 Subject: [PATCH] Remove last controller.row usages --- .../server/src/tests/utilities/TestConfiguration.ts | 10 +++------- packages/server/src/tests/utilities/api/row.ts | 3 +++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index adb36ee491..f7f49e1338 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -39,7 +39,6 @@ import { view as viewController, } from "./controllers" -import * as controllers from "./controllers" import { cleanup } from "../../utilities/fileSystem" import newid from "../../db/newid" import { generateUserMetadataID } from "../../db/utils" @@ -56,7 +55,7 @@ import { RelationshipFieldMetadata, RelationshipType, Row, - SearchFilters, + SearchParams, SourceName, Table, TableSourceType, @@ -706,14 +705,11 @@ class TestConfiguration { return this.api.row.fetch(tableId) } - async searchRows(tableId: string, searchParams: SearchFilters = {}) { + async searchRows(tableId: string, searchParams?: SearchParams) { if (!tableId && this.table) { tableId = this.table._id! } - const body = { - query: searchParams, - } - return this._req(body, { tableId }, controllers.row.search) + return this.api.row.search(tableId, searchParams) } // ROLE diff --git a/packages/server/src/tests/utilities/api/row.ts b/packages/server/src/tests/utilities/api/row.ts index 3d4cf6c82c..936c906f9f 100644 --- a/packages/server/src/tests/utilities/api/row.ts +++ b/packages/server/src/tests/utilities/api/row.ts @@ -7,6 +7,7 @@ import { BulkImportRequest, BulkImportResponse, SearchRowResponse, + SearchParams, } from "@budibase/types" import TestConfiguration from "../TestConfiguration" import { TestAPI } from "./base" @@ -154,10 +155,12 @@ export class RowAPI extends TestAPI { search = async ( sourceId: string, + params?: SearchParams, { expectStatus } = { expectStatus: 200 } ): Promise => { const request = this.request .post(`/api/${sourceId}/search`) + .send(params) .set(this.config.defaultHeaders()) .expect(expectStatus)