Fix broken frontend test.

This commit is contained in:
Sam Rose 2024-10-21 16:18:39 +01:00
parent f0fd81b752
commit 49477330c2
No known key found for this signature in database
2 changed files with 8 additions and 2 deletions

View File

@ -79,6 +79,8 @@ describe("Export Modal", () => {
props: propsCfg, props: propsCfg,
}) })
expect(propsCfg.filters[0].field).toBe("1:Cost")
expect(screen.getByTestId("filters-applied")).toBeVisible() expect(screen.getByTestId("filters-applied")).toBeVisible()
expect(screen.getByTestId("filters-applied").textContent).toBe( expect(screen.getByTestId("filters-applied").textContent).toBe(
"Filters applied" "Filters applied"

View File

@ -147,8 +147,12 @@ export const processSearchFilters = (
{ {
logicalOperator: allOr ? UILogicalOperator.ANY : UILogicalOperator.ALL, logicalOperator: allOr ? UILogicalOperator.ANY : UILogicalOperator.ALL,
filters: filters.map(filter => { filters: filters.map(filter => {
filter.field = removeKeyNumbering(filter.field) const trimmedFilter = _.pick(
return _.pick(filter, FILTER_ALLOWED_KEYS) as SearchFilter filter,
FILTER_ALLOWED_KEYS
) as SearchFilter
trimmedFilter.field = removeKeyNumbering(trimmedFilter.field)
return trimmedFilter
}), }),
}, },
], ],