From 49477330c23f635b2157d1329d247349f0a9adcd Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 21 Oct 2024 16:18:39 +0100 Subject: [PATCH] Fix broken frontend test. --- .../backend/DataTable/modals/ExportModal.test.js | 2 ++ packages/shared-core/src/utils.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/ExportModal.test.js b/packages/builder/src/components/backend/DataTable/modals/ExportModal.test.js index a5d24d7435..4927f51a8d 100644 --- a/packages/builder/src/components/backend/DataTable/modals/ExportModal.test.js +++ b/packages/builder/src/components/backend/DataTable/modals/ExportModal.test.js @@ -79,6 +79,8 @@ describe("Export Modal", () => { props: propsCfg, }) + expect(propsCfg.filters[0].field).toBe("1:Cost") + expect(screen.getByTestId("filters-applied")).toBeVisible() expect(screen.getByTestId("filters-applied").textContent).toBe( "Filters applied" diff --git a/packages/shared-core/src/utils.ts b/packages/shared-core/src/utils.ts index dce1b8b960..2bfd166414 100644 --- a/packages/shared-core/src/utils.ts +++ b/packages/shared-core/src/utils.ts @@ -147,8 +147,12 @@ export const processSearchFilters = ( { logicalOperator: allOr ? UILogicalOperator.ANY : UILogicalOperator.ALL, filters: filters.map(filter => { - filter.field = removeKeyNumbering(filter.field) - return _.pick(filter, FILTER_ALLOWED_KEYS) as SearchFilter + const trimmedFilter = _.pick( + filter, + FILTER_ALLOWED_KEYS + ) as SearchFilter + trimmedFilter.field = removeKeyNumbering(trimmedFilter.field) + return trimmedFilter }), }, ],