{
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 () => {