From 78ee90253a388d3eb264f3d2d7a83feb6cf7240f Mon Sep 17 00:00:00 2001 From: nicholas-codecov Date: Mon, 27 Jan 2025 10:23:32 -0400 Subject: [PATCH 1/2] chore: Clean up bundle caching feature flag (#3659) --- .../BundleSelection/BundleSelection.test.tsx | 8 ----- .../BundleSelection/BundleSelection.tsx | 33 ++++++++----------- .../ConfigurationManager.test.tsx | 8 ----- .../ConfigurationManager.tsx | 33 ++++++++----------- 4 files changed, 26 insertions(+), 56 deletions(-) diff --git a/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.test.tsx b/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.test.tsx index 86205ad215..022d4de7ad 100644 --- a/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.test.tsx +++ b/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.test.tsx @@ -13,14 +13,6 @@ import { MemoryRouter, Route } from 'react-router-dom' import BundleSelection from './BundleSelection' -const mocks = vi.hoisted(() => ({ - useFlags: vi.fn().mockReturnValue({ displayBundleCachingModal: true }), -})) - -vi.mock('shared/featureFlags', () => ({ - useFlags: mocks.useFlags, -})) - const mockRepoOverview = { __typename: 'Repository', private: false, diff --git a/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.tsx b/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.tsx index df9dd9fc2d..add449b6b4 100644 --- a/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.tsx +++ b/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.tsx @@ -1,7 +1,6 @@ import { lazy, useCallback, useRef, useState } from 'react' import { ConfigureCachedBundleModal } from 'pages/RepoPage/shared/ConfigureCachedBundleModal/ConfigureCachedBundleModal' -import { useFlags } from 'shared/featureFlags' import Icon from 'ui/Icon' import BranchSelector from './BranchSelector' @@ -16,10 +15,6 @@ const BundleSelection: React.FC = () => { const [showBundleCachingModal, setShowBundleCachingModal] = useState(false) - const { displayBundleCachingModal } = useFlags({ - displayBundleCachingModal: false, - }) - const resetFilterSelects = useCallback(() => { typesSelectRef.current?.resetSelected() loadingSelectRef?.current?.resetSelected() @@ -40,21 +35,19 @@ const BundleSelection: React.FC = () => { /> - {displayBundleCachingModal ? ( -
- - -
- ) : null} +
+ + +
) diff --git a/src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.test.tsx b/src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.test.tsx index d13ae519f1..dceec84c53 100644 --- a/src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.test.tsx +++ b/src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.test.tsx @@ -14,14 +14,6 @@ import { MemoryRouter, Route } from 'react-router' import ConfigurationManager from './ConfigurationManager' import { RepositoryConfiguration } from './hooks/useRepoConfigurationStatus/RepoConfigurationStatusQueryOpts' -const mocks = vi.hoisted(() => ({ - useFlags: vi.fn().mockReturnValue({ displayBundleCachingModal: true }), -})) - -vi.mock('shared/featureFlags', () => ({ - useFlags: mocks.useFlags, -})) - interface mockRepoConfigArgs { isTeamPlan?: boolean flags?: boolean diff --git a/src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.tsx b/src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.tsx index 4264a29969..79e3747eba 100644 --- a/src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.tsx +++ b/src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.tsx @@ -3,7 +3,6 @@ import { useState } from 'react' import { useParams } from 'react-router' import { ConfigureCachedBundleModal } from 'pages/RepoPage/shared/ConfigureCachedBundleModal/ConfigureCachedBundleModal' -import { useFlags } from 'shared/featureFlags' import Icon from 'ui/Icon' import FeatureGroup from './components/FeatureGroup' @@ -144,10 +143,6 @@ function TestAnalyticsConfiguration({ function BundleAnalysisConfiguration({ repoConfiguration, }: ConfigurationGroupProps) { - const { displayBundleCachingModal } = useFlags({ - displayBundleCachingModal: false, - }) - const [showBundleCachingModal, setShowBundleCachingModal] = useState(false) const jsOrTsPresent = !!repoConfiguration?.repository?.languages?.some( (lang) => @@ -177,21 +172,19 @@ function BundleAnalysisConfiguration({ > Track, monitor, and manage your bundle - {displayBundleCachingModal ? ( -
- - -
- ) : null} +
+ + +
) From 4b05dffee27d8615bc824cb0c40e84c43f77509d Mon Sep 17 00:00:00 2001 From: nicholas-codecov Date: Mon, 27 Jan 2025 10:28:47 -0400 Subject: [PATCH 2/2] chore: Add in Owner/RepoContext MSW Mocks to App tests (#3682) --- src/App.test.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/App.test.tsx b/src/App.test.tsx index 93afca9b91..2de2725e59 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -135,6 +135,14 @@ const mockNavigatorData = { }, } +const mockOwnerContext = { owner: { ownerid: 123 } } + +const mockRepoContext = { + owner: { + repository: { __typename: 'Repository', repoid: 321, private: false }, + }, +} + const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } }, }) @@ -249,6 +257,12 @@ describe('App', () => { }), graphql.query('NavigatorData', () => { return HttpResponse.json({ data: mockNavigatorData }) + }), + graphql.query('OwnerContext', () => { + return HttpResponse.json({ data: mockOwnerContext }) + }), + graphql.query('RepoContext', () => { + return HttpResponse.json({ data: mockRepoContext }) }) ) }