From 945a55ab1a3e5f2957e96ef894fa42b706eb7c36 Mon Sep 17 00:00:00 2001 From: Mirjam Aulbach Date: Tue, 23 Jan 2024 15:32:33 +0100 Subject: [PATCH] feat(coral): Remove feature flag topic-type-filter (#2234) Remove feature flag. Signed-off-by: Mirjam Aulbach --- .../topics/browse/BrowseTopics.test.tsx | 60 +++---------------- .../features/topics/browse/BrowseTopics.tsx | 10 +--- coral/src/services/feature-flags/types.ts | 1 - coral/vite.config.ts | 3 - 4 files changed, 10 insertions(+), 64 deletions(-) diff --git a/coral/src/app/features/topics/browse/BrowseTopics.test.tsx b/coral/src/app/features/topics/browse/BrowseTopics.test.tsx index 2331cd9cf7..1e4acbc61f 100644 --- a/coral/src/app/features/topics/browse/BrowseTopics.test.tsx +++ b/coral/src/app/features/topics/browse/BrowseTopics.test.tsx @@ -17,8 +17,6 @@ import { TopicApiResponse } from "src/domain/topic/topic-types"; import { mockIntersectionObserver } from "src/services/test-utils/mock-intersection-observer"; import { customRender } from "src/services/test-utils/render-with-wrappers"; import { tabNavigateTo } from "src/services/test-utils/tabbing"; -import { setupFeatureFlagMock } from "src/services/feature-flags/test-helper"; -import { FeatureFlag } from "src/services/feature-flags/types"; jest.mock("src/domain/team/team-api.ts"); jest.mock("src/domain/topic/topic-api.ts"); @@ -85,53 +83,6 @@ describe("BrowseTopics.tsx", () => { teamId: undefined, }; - describe("renders a select element for Topic types based on a feature flag", () => { - beforeEach(() => { - mockGetTeams.mockResolvedValue(mockGetTeamsResponse); - mockGetEnvironments.mockResolvedValue(mockGetEnvironmentResponse); - mockGetTopics.mockResolvedValue(mockedGetTopicsResponseSinglePage); - }); - - afterEach(cleanup); - - it("does not show the select for Topic type when feature flag is not enabled", async () => { - customRender(, { - memoryRouter: true, - queryClient: true, - aquariumContext: true, - }); - await waitForElementToBeRemoved( - screen.getAllByTestId(/async-select-loading/) - ); - - const select = screen.queryByRole("combobox", { - name: filterByTopicTypeLabel, - }); - - expect(select).not.toBeInTheDocument(); - }); - - it("shows a select for Topic type when feature flag is enabled", async () => { - setupFeatureFlagMock(FeatureFlag.FEATURE_FLAG_TOPIC_TYPE_FILTER, true); - - customRender(, { - memoryRouter: true, - queryClient: true, - aquariumContext: true, - }); - - await waitForElementToBeRemoved( - screen.getAllByTestId(/async-select-loading/) - ); - - const select = screen.getByRole("combobox", { - name: filterByTopicTypeLabel, - }); - - expect(select).toBeEnabled(); - }); - }); - describe("handles successful response with one page", () => { beforeAll(async () => { mockGetTeams.mockResolvedValue(mockGetTeamsResponse); @@ -169,6 +120,14 @@ describe("BrowseTopics.tsx", () => { expect(select).toBeEnabled(); }); + it("shows a select for Topic type", () => { + const select = screen.getByRole("combobox", { + name: filterByTopicTypeLabel, + }); + + expect(select).toBeEnabled(); + }); + it("renders the topic table with information about the pages", async () => { const table = screen.getByRole("table", { name: "Topics overview, page 1 of 1", @@ -391,9 +350,8 @@ describe("BrowseTopics.tsx", () => { }); }); - describe("handles user filtering topics by type when feature flag is active", () => { + describe("handles user filtering topics by type", () => { beforeEach(async () => { - setupFeatureFlagMock(FeatureFlag.FEATURE_FLAG_TOPIC_TYPE_FILTER, true); mockGetTeams.mockResolvedValue(mockGetTeamsResponse); mockGetEnvironments.mockResolvedValue([]); mockGetTopics.mockResolvedValue(mockedResponseTransformed); diff --git a/coral/src/app/features/topics/browse/BrowseTopics.tsx b/coral/src/app/features/topics/browse/BrowseTopics.tsx index 6bc16db4b9..76483eea23 100644 --- a/coral/src/app/features/topics/browse/BrowseTopics.tsx +++ b/coral/src/app/features/topics/browse/BrowseTopics.tsx @@ -12,14 +12,8 @@ import { TableLayout } from "src/app/features/components/layouts/TableLayout"; import TopicTable from "src/app/features/topics/browse/components/TopicTable"; import { getTopics } from "src/domain/topic"; import { TopicTypeFilter } from "src/app/features/components/filters/TopicTypeFilter"; -import useFeatureFlag from "src/services/feature-flags/hook/useFeatureFlag"; -import { FeatureFlag } from "src/services/feature-flags/types"; function BrowseTopics() { - const topicTypeFilterEnabled = useFeatureFlag( - FeatureFlag.FEATURE_FLAG_TOPIC_TYPE_FILTER - ); - const [searchParams, setSearchParams] = useSearchParams(); const currentPage = searchParams.get("page") @@ -75,9 +69,7 @@ function BrowseTopics() { key="environment" environmentsFor={"TOPIC_AND_ACL"} />, - ...(topicTypeFilterEnabled - ? [] - : []), + , , ]} table={ diff --git a/coral/src/services/feature-flags/types.ts b/coral/src/services/feature-flags/types.ts index a8ea962d9b..71a70abefe 100644 --- a/coral/src/services/feature-flags/types.ts +++ b/coral/src/services/feature-flags/types.ts @@ -1,6 +1,5 @@ enum FeatureFlag { FEATURE_FLAG_DASHBOARD = "FEATURE_FLAG_DASHBOARD", - FEATURE_FLAG_TOPIC_TYPE_FILTER = "FEATURE_FLAG_TOPIC_TYPE_FILTER", } export { FeatureFlag }; diff --git a/coral/vite.config.ts b/coral/vite.config.ts index 3edc700259..85051624f8 100644 --- a/coral/vite.config.ts +++ b/coral/vite.config.ts @@ -141,9 +141,6 @@ export default defineConfig(({ mode }) => { FEATURE_FLAG_DASHBOARD: ["development", "remote-api"] .includes(mode) .toString(), - FEATURE_FLAG_TOPIC_TYPE_FILTER: ["development", "remote-api"] - .includes(mode) - .toString(), }, }, css: {