diff --git a/src/pages/AccountSettings/shared/Header/Header.jsx b/src/pages/AccountSettings/shared/Header/Header.jsx index fad0b8c533..3924530f6e 100644 --- a/src/pages/AccountSettings/shared/Header/Header.jsx +++ b/src/pages/AccountSettings/shared/Header/Header.jsx @@ -4,22 +4,18 @@ import config from 'config' import MyContextSwitcher from 'layouts/MyContextSwitcher' import { TierNames, useTier } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import TabNavigation from 'ui/TabNavigation' function Header() { const { owner, provider } = useParams() const { data: tierName } = useTier({ owner, provider }) - const { multipleTiers } = useFlags({ - multipleTiers: true, - }) return ( <> { describe('Header', () => { function setup( - { isSelfHosted = false, multipleTiers = false } = { + { isSelfHosted = false, tierValue = TierNames.PRO } = { isSelfHosted: false, - multipleTiers: false, + tierValue: TierNames.PRO, } ) { config.IS_SELF_HOSTED = isSelfHosted - useFlags.mockReturnValue({ - multipleTiers, - }) - server.use( graphql.query('OwnerTier', (req, res, ctx) => { - if (multipleTiers) { + if (tierValue === TierNames.TEAM) { return res( ctx.status(200), ctx.data({ owner: { plan: { tierName: TierNames.TEAM } } }) @@ -149,7 +143,7 @@ describe('Header', () => { describe('when user has team tier', () => { it('renders links to the home page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(
, { wrapper }) expect( @@ -160,7 +154,7 @@ describe('Header', () => { }) it('does not render links to the analytics page', async () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(
, { wrapper }) const analyticsLink = screen.queryByText(/Analytics/) @@ -168,7 +162,7 @@ describe('Header', () => { }) it('renders links to the settings page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(
, { wrapper }) expect( @@ -179,7 +173,7 @@ describe('Header', () => { }) it('renders link to plan page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(
, { wrapper }) expect( @@ -190,7 +184,7 @@ describe('Header', () => { }) it('renders link to members page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(
, { wrapper }) expect( diff --git a/src/pages/AnalyticsPage/AnalyticsPage.jsx b/src/pages/AnalyticsPage/AnalyticsPage.jsx index 947357daaf..5e645c1d58 100644 --- a/src/pages/AnalyticsPage/AnalyticsPage.jsx +++ b/src/pages/AnalyticsPage/AnalyticsPage.jsx @@ -6,7 +6,6 @@ import { useLocationParams } from 'services/navigation' import { orderingOptions } from 'services/repos' import { TierNames, useTier } from 'services/tier' import { useOwner } from 'services/user' -import { useFlags } from 'shared/featureFlags' import ReposTable from 'shared/ListRepo/ReposTable' import LoadingLogo from 'ui/LoadingLogo' @@ -39,9 +38,6 @@ function AnalyticsPage() { const { owner, provider } = useParams() const { data: ownerData } = useOwner({ username: owner }) const { data: tierName } = useTier({ owner, provider }) - const { multipleTiers } = useFlags({ - multipleTiers: true, - }) const orderOptions = orderingOptions @@ -56,7 +52,7 @@ function AnalyticsPage() { return } - if (tierName === TierNames.TEAM && multipleTiers) { + if (tierName === TierNames.TEAM) { return } diff --git a/src/pages/AnalyticsPage/AnalyticsPage.spec.jsx b/src/pages/AnalyticsPage/AnalyticsPage.spec.jsx index 9af65f982d..91f6134bce 100644 --- a/src/pages/AnalyticsPage/AnalyticsPage.spec.jsx +++ b/src/pages/AnalyticsPage/AnalyticsPage.spec.jsx @@ -7,7 +7,6 @@ import { MemoryRouter, Route } from 'react-router-dom' import { useLocationParams } from 'services/navigation' import { TierNames } from 'services/tier' import { useOwner } from 'services/user' -import { useFlags } from 'shared/featureFlags' import AnalyticsPage from './AnalyticsPage' @@ -19,7 +18,6 @@ jest.mock('./Tabs', () => () => 'Tabs') jest.mock('./ChartSelectors', () => () => 'Chart Selectors') jest.mock('./Chart', () => () => 'Line Chart') jest.mock('../../shared/ListRepo/ReposTable', () => () => 'ReposTable') -jest.mock('shared/featureFlags') const queryClient = new QueryClient() const server = setupServer() @@ -56,7 +54,7 @@ afterAll(() => { }) describe('AnalyticsPage', () => { - function setup({ owner, params, multipleTiers = false }) { + function setup({ owner, params, tierValue = TierNames.PRO }) { useOwner.mockReturnValue({ data: owner, }) @@ -67,13 +65,9 @@ describe('AnalyticsPage', () => { }, }) - useFlags.mockReturnValue({ - multipleTiers, - }) - server.use( graphql.query('OwnerTier', (req, res, ctx) => { - if (multipleTiers) { + if (tierValue === TierNames.TEAM) { return res( ctx.status(200), ctx.data({ owner: { plan: { tierName: TierNames.TEAM } } }) @@ -194,7 +188,7 @@ describe('AnalyticsPage', () => { username: 'codecov', isCurrentUserPartOfOrg: true, }, - multipleTiers: true, + tierValue: TierNames.TEAM, }) render(, { wrapper }) diff --git a/src/pages/AnalyticsPage/Tabs/Tabs.jsx b/src/pages/AnalyticsPage/Tabs/Tabs.jsx index dc343eef38..631b5052a3 100644 --- a/src/pages/AnalyticsPage/Tabs/Tabs.jsx +++ b/src/pages/AnalyticsPage/Tabs/Tabs.jsx @@ -3,15 +3,11 @@ import { useParams } from 'react-router-dom' import config from 'config' import { TierNames, useTier } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import TabNavigation from 'ui/TabNavigation' function Tabs() { const { owner, provider } = useParams() const { data: tierName } = useTier({ owner, provider }) - const { multipleTiers } = useFlags({ - multipleTiers: true, - }) return ( { describe('Tabs', () => { function setup( - { isSelfHosted = false, multipleTiers = false } = { + { isSelfHosted = false, tierValue = TierNames.PRO } = { isSelfHosted: false, - multipleTiers: false, + tierValue: TierNames.PRO, } ) { config.IS_SELF_HOSTED = isSelfHosted - useFlags.mockReturnValue({ - multipleTiers, - }) - server.use( graphql.query('OwnerTier', (req, res, ctx) => { - if (multipleTiers) { + if (tierValue === TierNames.TEAM) { return res( ctx.status(200), ctx.data({ owner: { plan: { tierName: TierNames.TEAM } } }) @@ -125,7 +119,7 @@ describe('Tabs', () => { describe('when user has team tier', () => { it('renders links to the home page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -136,7 +130,7 @@ describe('Tabs', () => { }) it('does not render links to the analytics page', async () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) const analyticsLink = screen.queryByText(/Analytics/) @@ -144,7 +138,7 @@ describe('Tabs', () => { }) it('renders links to the settings page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -155,7 +149,7 @@ describe('Tabs', () => { }) it('renders link to plan page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -166,7 +160,7 @@ describe('Tabs', () => { }) it('renders link to members page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( diff --git a/src/pages/MembersPage/Tabs/Tabs.jsx b/src/pages/MembersPage/Tabs/Tabs.jsx index dc343eef38..d4c5ad7ff2 100644 --- a/src/pages/MembersPage/Tabs/Tabs.jsx +++ b/src/pages/MembersPage/Tabs/Tabs.jsx @@ -3,15 +3,12 @@ import { useParams } from 'react-router-dom' import config from 'config' import { TierNames, useTier } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import TabNavigation from 'ui/TabNavigation' function Tabs() { const { owner, provider } = useParams() const { data: tierName } = useTier({ owner, provider }) - const { multipleTiers } = useFlags({ - multipleTiers: true, - }) + return ( { describe('Tabs', () => { function setup( - { isSelfHosted = false, multipleTiers = false } = { + { isSelfHosted = false, tierValue = TierNames.PRO } = { isSelfHosted: false, - multipleTiers: false, + tierValue: TierNames.PRO, } ) { config.IS_SELF_HOSTED = isSelfHosted - useFlags.mockReturnValue({ - multipleTiers, - }) - server.use( graphql.query('OwnerTier', (req, res, ctx) => { - if (multipleTiers) { + if (tierValue === TierNames.TEAM) { return res( ctx.status(200), ctx.data({ owner: { plan: { tierName: TierNames.TEAM } } }) @@ -149,7 +143,7 @@ describe('Tabs', () => { describe('when user has team tier', () => { it('renders links to the home page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -160,7 +154,7 @@ describe('Tabs', () => { }) it('does not render links to the analytics page', async () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) const analyticsLink = screen.queryByText(/Analytics/) @@ -168,7 +162,7 @@ describe('Tabs', () => { }) it('renders links to the settings page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -179,7 +173,7 @@ describe('Tabs', () => { }) it('renders link to plan page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -190,7 +184,7 @@ describe('Tabs', () => { }) it('renders link to members page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( diff --git a/src/pages/OwnerPage/Tabs/Tabs.jsx b/src/pages/OwnerPage/Tabs/Tabs.jsx index 73082e17f1..eabd561dde 100644 --- a/src/pages/OwnerPage/Tabs/Tabs.jsx +++ b/src/pages/OwnerPage/Tabs/Tabs.jsx @@ -5,7 +5,6 @@ import { useParams } from 'react-router-dom' import config from 'config' import { TierNames, useTier } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import TabNavigation from 'ui/TabNavigation' const TrialReminder = lazy(() => import('./TrialReminder')) @@ -13,9 +12,6 @@ const TrialReminder = lazy(() => import('./TrialReminder')) function Tabs() { const { owner, provider } = useParams() const { data: tierName } = useTier({ owner, provider }) - const { multipleTiers } = useFlags({ - multipleTiers: true, - }) return ( () => 'TrialReminder') jest.mock('config') -jest.mock('shared/featureFlags') const queryClient = new QueryClient() const server = setupServer() @@ -40,20 +38,16 @@ afterAll(() => { describe('Tabs', () => { function setup( - { isSelfHosted = false, multipleTiers = false } = { + { isSelfHosted = false, tierValue = TierNames.PRO } = { isSelfHosted: false, - multipleTiers: false, + tierValue: TierNames.PRO, } ) { config.IS_SELF_HOSTED = isSelfHosted - useFlags.mockReturnValue({ - multipleTiers, - }) - server.use( graphql.query('OwnerTier', (req, res, ctx) => { - if (multipleTiers) { + if (tierValue === TierNames.TEAM) { return res( ctx.status(200), ctx.data({ owner: { plan: { tierName: TierNames.TEAM } } }) @@ -131,7 +125,7 @@ describe('Tabs', () => { describe('when user has team tier', () => { it('renders links to the home page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -142,7 +136,7 @@ describe('Tabs', () => { }) it('does not render links to the analytics page', async () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) const analyticsLink = screen.queryByText(/Analytics/) @@ -150,7 +144,7 @@ describe('Tabs', () => { }) it('renders links to the settings page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -161,7 +155,7 @@ describe('Tabs', () => { }) it('renders link to plan page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -172,7 +166,7 @@ describe('Tabs', () => { }) it('renders link to members page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( diff --git a/src/pages/PlanPage/Tabs/Tabs.jsx b/src/pages/PlanPage/Tabs/Tabs.jsx index ce1d10dcee..d4c5ad7ff2 100644 --- a/src/pages/PlanPage/Tabs/Tabs.jsx +++ b/src/pages/PlanPage/Tabs/Tabs.jsx @@ -3,15 +3,11 @@ import { useParams } from 'react-router-dom' import config from 'config' import { TierNames, useTier } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import TabNavigation from 'ui/TabNavigation' function Tabs() { const { owner, provider } = useParams() const { data: tierName } = useTier({ owner, provider }) - const { multipleTiers } = useFlags({ - multipleTiers: true, - }) return ( { describe('Tabs', () => { function setup( - { isSelfHosted = false, multipleTiers = false } = { + { isSelfHosted = false, tierValue = TierNames.PRO } = { isSelfHosted: false, - multipleTiers: false, + tierValue: TierNames.PRO, } ) { config.IS_SELF_HOSTED = isSelfHosted - useFlags.mockReturnValue({ - multipleTiers, - }) - server.use( graphql.query('OwnerTier', (req, res, ctx) => { - if (multipleTiers) { + if (tierValue === TierNames.TEAM) { return res( ctx.status(200), ctx.data({ owner: { plan: { tierName: TierNames.TEAM } } }) @@ -125,7 +119,7 @@ describe('Tabs', () => { describe('when user has team tier', () => { it('renders links to the home page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -136,7 +130,7 @@ describe('Tabs', () => { }) it('does not render links to the analytics page', async () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) const analyticsLink = screen.queryByText(/Analytics/) @@ -144,7 +138,7 @@ describe('Tabs', () => { }) it('renders links to the settings page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -155,7 +149,7 @@ describe('Tabs', () => { }) it('renders link to plan page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( @@ -166,7 +160,7 @@ describe('Tabs', () => { }) it('renders link to members page', () => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) expect( diff --git a/src/pages/RepoPage/FlagsTab/FlagsTab.jsx b/src/pages/RepoPage/FlagsTab/FlagsTab.jsx index 84d7a432b1..03af190b99 100644 --- a/src/pages/RepoPage/FlagsTab/FlagsTab.jsx +++ b/src/pages/RepoPage/FlagsTab/FlagsTab.jsx @@ -4,7 +4,6 @@ import { SentryRoute } from 'sentry' import { useRepoFlagsSelect } from 'services/repo/useRepoFlagsSelect' import { TierNames, useTier } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import FlagsNotConfigured from 'shared/FlagsNotConfigured' import blurredTable from './assets/blurredTable.png' @@ -32,7 +31,6 @@ function FlagsTab() { const { data: flagsData } = useRepoFlagsSelect() const { provider, owner, repo } = useParams() const { data: tierData } = useTier({ owner, provider }) - const { multipleTiers } = useFlags({ multipleTiers: true }) const { flagsMeasurementsActive, @@ -41,7 +39,7 @@ function FlagsTab() { isTimescaleEnabled, } = useRepoBackfillingStatus() - if (tierData === TierNames.TEAM && multipleTiers) { + if (tierData === TierNames.TEAM) { return } diff --git a/src/pages/RepoPage/FlagsTab/FlagsTab.spec.jsx b/src/pages/RepoPage/FlagsTab/FlagsTab.spec.jsx index 600fdcee02..047dd0eb51 100644 --- a/src/pages/RepoPage/FlagsTab/FlagsTab.spec.jsx +++ b/src/pages/RepoPage/FlagsTab/FlagsTab.spec.jsx @@ -7,7 +7,6 @@ import { MemoryRouter, Route } from 'react-router-dom' import { useRepoBackfilled, useRepoFlagsSelect } from 'services/repo' import { TierNames } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import FlagsTab from './FlagsTab' @@ -69,17 +68,13 @@ afterEach(() => { afterAll(() => server.close()) describe('Flags Tab', () => { - function setup({ data = {}, flags = flagsData, multipleTiers = false }) { + function setup({ data = {}, flags = flagsData, tierValue = TierNames.PRO }) { useRepoFlagsSelect.mockReturnValue({ data: flags }) useRepoBackfilled.mockReturnValue(data) - useFlags.mockReturnValue({ - multipleTiers, - }) - server.use( graphql.query('OwnerTier', (req, res, ctx) => { - if (multipleTiers) { + if (tierValue === TierNames.TEAM) { return res( ctx.status(200), ctx.data({ owner: { plan: { tierName: TierNames.TEAM } } }) @@ -95,7 +90,7 @@ describe('Flags Tab', () => { describe('when user has a team tier', () => { beforeEach(() => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) }) it('redirects to the coverage tab', async () => { diff --git a/src/pages/RepoPage/RepoPage.jsx b/src/pages/RepoPage/RepoPage.jsx index 63cba6c921..50ab229dc9 100644 --- a/src/pages/RepoPage/RepoPage.jsx +++ b/src/pages/RepoPage/RepoPage.jsx @@ -7,7 +7,6 @@ import NotFound from 'pages/NotFound' import { useRepo } from 'services/repo' import { TierNames, useTier } from 'services/tier' import CustomError from 'shared/CustomError' -import { useFlags } from 'shared/featureFlags' import A from 'ui/A' import LoadingLogo from 'ui/LoadingLogo' import TabNavigation from 'ui/TabNavigation' @@ -33,7 +32,6 @@ const getRepoTabs = ({ provider, owner, repo, - multipleTiers, tierData, }) => { let location = undefined @@ -50,9 +48,7 @@ const getRepoTabs = ({ exact: !matchTree && !matchBlobs, location, }, - ...(tierData === TierNames.TEAM && multipleTiers - ? [] - : [{ pageName: 'flagsTab' }]), + ...(tierData === TierNames.TEAM ? [] : [{ pageName: 'flagsTab' }]), { pageName: 'commits' }, { pageName: 'pulls' }, ...(isCurrentUserPartOfOrg ? [{ pageName: 'settings' }] : []), @@ -69,7 +65,6 @@ function RepoPage() { const { provider, owner, repo } = useParams() const [refetchEnabled, setRefetchEnabled] = useState(false) const { data: tierData } = useTier({ owner, provider }) - const { multipleTiers } = useFlags({ multipleTiers: true }) const { data: repoData } = useRepo({ provider, @@ -120,7 +115,6 @@ function RepoPage() { provider, owner, repo, - multipleTiers, tierData, })} /> diff --git a/src/pages/RepoPage/RepoPage.spec.jsx b/src/pages/RepoPage/RepoPage.spec.jsx index 0a1b80c35b..a60f51157d 100644 --- a/src/pages/RepoPage/RepoPage.spec.jsx +++ b/src/pages/RepoPage/RepoPage.spec.jsx @@ -8,7 +8,6 @@ import { MemoryRouter, Route } from 'react-router-dom' import NetworkErrorBoundary from 'layouts/shared/NetworkErrorBoundary' import { TierNames } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import { RepoBreadcrumbProvider } from './context' import RepoPage from './RepoPage' @@ -111,7 +110,7 @@ describe('RepoPage', () => { isRepoPrivate, isRepoActivated, isRepoActive, - multipleTiers, + tierValue, } = { noUploadToken: false, isCurrentUserPartOfOrg: true, @@ -119,15 +118,11 @@ describe('RepoPage', () => { isRepoPrivate: false, isRepoActivated: true, isRepoActive: true, - multipleTiers: false, + tierValue: TierNames.PRO, } ) { const user = userEvent.setup() - useFlags.mockReturnValue({ - multipleTiers, - }) - server.use( graphql.query('GetRepo', (req, res, ctx) => { if (hasRepoData) { @@ -148,7 +143,7 @@ describe('RepoPage', () => { return res(ctx.status(200), ctx.data({ owner: {} })) }), graphql.query('OwnerTier', (req, res, ctx) => { - if (multipleTiers) { + if (tierValue === TierNames.TEAM) { return res( ctx.status(200), ctx.data({ owner: { plan: { tierName: TierNames.TEAM } } }) @@ -257,7 +252,7 @@ describe('RepoPage', () => { describe('user is part of org and has team tier', () => { it('has a coverage tab', async () => { const { user } = setup({ - multipleTiers: true, + tierValue: TierNames.TEAM, hasRepoData: true, }) render(, { @@ -277,7 +272,7 @@ describe('RepoPage', () => { it('does not have a flags tab', () => { setup({ - multipleTiers: true, + tierValue: TierNames.TEAM, hasRepoData: true, }) render(, { wrapper: wrapper() }) @@ -288,7 +283,7 @@ describe('RepoPage', () => { it('has a commits tab', async () => { const { user } = setup({ - multipleTiers: true, + tierValue: TierNames.TEAM, hasRepoData: true, }) render(, { wrapper: wrapper() }) @@ -306,7 +301,7 @@ describe('RepoPage', () => { it('has a pulls tab', async () => { const { user } = setup({ - multipleTiers: true, + tierValue: TierNames.TEAM, hasRepoData: true, }) render(, { wrapper: wrapper() }) @@ -324,7 +319,7 @@ describe('RepoPage', () => { it('has a settings tab', async () => { const { user } = setup({ - multipleTiers: true, + tierValue: TierNames.TEAM, hasRepoData: true, }) render(, { wrapper: wrapper() }) diff --git a/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/GeneralTab.jsx b/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/GeneralTab.jsx index 91a8a70027..00762fcdce 100644 --- a/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/GeneralTab.jsx +++ b/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/GeneralTab.jsx @@ -1,7 +1,6 @@ import { useParams } from 'react-router-dom' import { TierNames, useTier } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import DangerZone from './DangerZone' import DefaultBranch from './DefaultBranch' @@ -17,18 +16,10 @@ function GeneralTab() { }) const { data: tierData } = useTier({ provider, owner }) - const { multipleTiers } = useFlags({ - multipleTiers: false, - }) - return (
{defaultBranch && } - {tierData === TierNames.TEAM && multipleTiers ? ( - - ) : ( - - )} + {tierData === TierNames.TEAM ? : }
) diff --git a/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/GeneralTab.spec.jsx b/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/GeneralTab.spec.jsx index 50780a3146..b40372e59d 100644 --- a/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/GeneralTab.spec.jsx +++ b/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/GeneralTab.spec.jsx @@ -5,7 +5,6 @@ import { setupServer } from 'msw/node' import { MemoryRouter, Route } from 'react-router-dom' import { TierNames } from 'services/tier' -import { useFlags } from 'shared/featureFlags' import GeneralTab from './GeneralTab' @@ -13,7 +12,6 @@ jest.mock('./Tokens/TokensTeam', () => () => 'Tokens Team Component') jest.mock('./Tokens/Tokens', () => () => 'Tokens Component') jest.mock('./DangerZone', () => () => 'DangerZone Component') jest.mock('./DefaultBranch', () => () => 'Default Branch') -jest.mock('shared/featureFlags') const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } }, @@ -40,15 +38,11 @@ afterAll(() => server.close()) describe('GeneralTab', () => { function setup( - { hasDefaultBranch = false, multipleTiers = false } = { + { hasDefaultBranch = false, tierValue = TierNames.PRO } = { hasDefaultBranch: false, - multipleTiers: false, + tierValue: TierNames.PRO, } ) { - useFlags.mockReturnValue({ - multipleTiers, - }) - server.use( graphql.query('RepoDefaultBranch', (req, res, ctx) => { if (hasDefaultBranch) { @@ -77,7 +71,7 @@ describe('GeneralTab', () => { ) }), graphql.query('OwnerTier', (req, res, ctx) => { - if (multipleTiers) { + if (tierValue === TierNames.TEAM) { return res( ctx.status(200), ctx.data({ owner: { plan: { tierName: TierNames.TEAM } } }) @@ -116,7 +110,7 @@ describe('GeneralTab', () => { }) it('render tokens component', () => { - setup({ multipleTiers: false }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) const tokensComponent = screen.getByText(/Tokens Component/) @@ -124,7 +118,7 @@ describe('GeneralTab', () => { }) it('render danger zone component', () => { - setup({ multipleTiers: false }) + setup({ tierValue: TierNames.TEAM }) render(, { wrapper }) const tokensComponent = screen.getByText(/DangerZone Component/) @@ -134,7 +128,7 @@ describe('GeneralTab', () => { describe('when rendered with team tier', () => { beforeEach(() => { - setup({ multipleTiers: true }) + setup({ tierValue: TierNames.TEAM }) }) it('render tokens team component', async () => { diff --git a/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/Tokens/TokensTeam/TokensTeam.spec.js b/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/Tokens/TokensTeam/TokensTeam.spec.js index 8da0d9b872..31e7cb57b7 100644 --- a/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/Tokens/TokensTeam/TokensTeam.spec.js +++ b/src/pages/RepoPage/SettingsTab/tabs/GeneralTab/Tokens/TokensTeam/TokensTeam.spec.js @@ -52,7 +52,7 @@ describe('TokensTeam', () => { describe('when rendered', () => { beforeEach(() => { - setup({ showStaticAnalysis: false, multipleTiers: true }) + setup({ showStaticAnalysis: false }) }) it('renders Repository upload token component', async () => {