From adfa7c3f29b0baf6bf967e218803916466dd71ca Mon Sep 17 00:00:00 2001 From: Mounir Dhahri Date: Tue, 17 Oct 2023 17:23:58 +0200 Subject: [PATCH] chore(ONYX-458): remove uknown edition as a rarity option (#9439) * chore: remove uknown edition as a rarity option * refactor: rename var --- .../ArtworkFilter/Filters/AttributionClassOptions.tsx | 6 +++++- .../Components/SavedSearchFilterRarity.tests.tsx | 5 ++--- .../Components/SavedSearchFilterRarity.tsx | 4 ++-- src/app/Scenes/SavedSearchAlert/pillExtractors.tests.ts | 7 +------ src/app/Scenes/SavedSearchAlert/pillExtractors.ts | 6 ++++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/app/Components/ArtworkFilter/Filters/AttributionClassOptions.tsx b/src/app/Components/ArtworkFilter/Filters/AttributionClassOptions.tsx index 7f2b30f5653..ef74e3933d4 100644 --- a/src/app/Components/ArtworkFilter/Filters/AttributionClassOptions.tsx +++ b/src/app/Components/ArtworkFilter/Filters/AttributionClassOptions.tsx @@ -13,7 +13,7 @@ type AttributionClassOptionsScreenProps = StackScreenProps< "AttributionClassOptionsScreen" > -export const ATTRIBUTION_CLASS_OPTIONS: FilterData[] = [ +export const KNOWN_ATTRIBUTION_CLASS_OPTIONS: FilterData[] = [ { displayText: "Unique", paramValue: "unique", paramName: FilterParamName.attributionClass }, { displayText: "Limited Edition", @@ -25,6 +25,10 @@ export const ATTRIBUTION_CLASS_OPTIONS: FilterData[] = [ paramValue: "open edition", paramName: FilterParamName.attributionClass, }, +] + +export const ATTRIBUTION_CLASS_OPTIONS: FilterData[] = [ + ...KNOWN_ATTRIBUTION_CLASS_OPTIONS, { displayText: "Unknown Edition", paramValue: "unknown edition", diff --git a/src/app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity.tests.tsx b/src/app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity.tests.tsx index 961840174b0..b665271bc26 100644 --- a/src/app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity.tests.tsx +++ b/src/app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity.tests.tsx @@ -1,6 +1,6 @@ import { OwnerType } from "@artsy/cohesion" import { fireEvent, waitFor } from "@testing-library/react-native" -import { ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions" +import { KNOWN_ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions" import { SavedSearchFilterRarity } from "app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity" import { SavedSearchModel, @@ -19,7 +19,7 @@ describe("SavedSearchFilterRarity", () => { ) - ATTRIBUTION_CLASS_OPTIONS.forEach((option) => { + KNOWN_ATTRIBUTION_CLASS_OPTIONS.forEach((option) => { expect(getByText(option.displayText)).toBeDefined() expect(getByText(option.displayText)).toHaveStyle({ color: black100Hex, @@ -39,7 +39,6 @@ describe("SavedSearchFilterRarity", () => { expect(getByText("Unique")).not.toHaveStyle({ color: black100Hex }) expect(getByText("Limited Edition")).toHaveStyle({ color: black100Hex }) expect(getByText("Open Edition")).toHaveStyle({ color: black100Hex }) - expect(getByText("Unknown Edition")).toHaveStyle({ color: black100Hex }) }) it("Updates selected filters on press", () => { diff --git a/src/app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity.tsx b/src/app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity.tsx index 82402bf0d37..f689e3c7c54 100644 --- a/src/app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity.tsx +++ b/src/app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity.tsx @@ -1,5 +1,5 @@ import { Flex, Spacer, Text } from "@artsy/palette-mobile" -import { ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions" +import { KNOWN_ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions" import { SearchCriteria } from "app/Components/ArtworkFilter/SavedSearch/types" import { SavedSearchFilterPill } from "app/Scenes/SavedSearchAlert/Components/SavedSearchFilterPill" import { SavedSearchStore } from "app/Scenes/SavedSearchAlert/SavedSearchStore" @@ -46,7 +46,7 @@ export const SavedSearchFilterRarity = () => { - {ATTRIBUTION_CLASS_OPTIONS.map((option) => { + {KNOWN_ATTRIBUTION_CLASS_OPTIONS.map((option) => { return ( { it("should correctly extract attribution pills", () => { const attributes: SearchCriteriaAttributes = { - attributionClass: ["unique", "unknown edition"], + attributionClass: ["unique"], } const result = extractPillsFromCriteria({ attributes, aggregations, unit: "in" }) @@ -249,11 +249,6 @@ describe("extractPillsFromCriteria", () => { paramName: SearchCriteria.attributionClass, value: "unique", }, - { - label: "Unknown Edition", - paramName: SearchCriteria.attributionClass, - value: "unknown edition", - }, ]) }) diff --git a/src/app/Scenes/SavedSearchAlert/pillExtractors.ts b/src/app/Scenes/SavedSearchAlert/pillExtractors.ts index d871cc16435..e6dd6961abc 100644 --- a/src/app/Scenes/SavedSearchAlert/pillExtractors.ts +++ b/src/app/Scenes/SavedSearchAlert/pillExtractors.ts @@ -4,7 +4,7 @@ import { FilterParamName, getDisplayNameForTimePeriod, } from "app/Components/ArtworkFilter/ArtworkFilterHelpers" -import { ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions" +import { KNOWN_ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions" import { COLORS_INDEXED_BY_VALUE } from "app/Components/ArtworkFilter/Filters/ColorsOptions" import { getSizeOptions } from "app/Components/ArtworkFilter/Filters/SizesOptionsScreen" import { @@ -124,7 +124,9 @@ export const extractColorPills = (values: string[]): SavedSearchPill[] => { export const extractAttributionPills = (values: string[]): SavedSearchPill[] => { return values.map((value) => { - const colorOption = ATTRIBUTION_CLASS_OPTIONS.find((option) => option.paramValue === value) + const colorOption = KNOWN_ATTRIBUTION_CLASS_OPTIONS.find( + (option) => option.paramValue === value + ) return { label: colorOption?.displayText ?? "",