aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2022-10-10 16:07:02 +0200
committersonartech <sonartech@sonarsource.com>2022-10-12 20:03:43 +0000
commit687e4c8d3830ff68fe39f60d8db18e9afe007bc6 (patch)
tree347640c307b703934a7f52e386c1f3e7904badb7 /server/sonar-web/src/main/js/helpers
parentb7782da37057932f728f41b11553bc0592b0a141 (diff)
downloadsonarqube-687e4c8d3830ff68fe39f60d8db18e9afe007bc6.tar.gz
sonarqube-687e4c8d3830ff68fe39f60d8db18e9afe007bc6.zip
SONAR-17118 migrate branch support flag to features/list API
Diffstat (limited to 'server/sonar-web/src/main/js/helpers')
-rw-r--r--server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx32
1 files changed, 19 insertions, 13 deletions
diff --git a/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx b/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
index 0ba3c484d6d..c92cb3f960c 100644
--- a/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
+++ b/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
@@ -24,6 +24,7 @@ import { IntlProvider } from 'react-intl';
import { MemoryRouter, Outlet, parsePath, Route, Routes } from 'react-router-dom';
import AdminContext from '../app/components/AdminContext';
import AppStateContextProvider from '../app/components/app-state/AppStateContextProvider';
+import { AvailableFeaturesContext } from '../app/components/available-features/AvailableFeaturesContext';
import { ComponentContext } from '../app/components/componentContext/ComponentContext';
import CurrentUserContextProvider from '../app/components/current-user/CurrentUserContextProvider';
import GlobalMessagesContainer from '../app/components/GlobalMessagesContainer';
@@ -33,6 +34,7 @@ import { MetricsContext } from '../app/components/metrics/MetricsContext';
import { useLocation } from '../components/hoc/withRouter';
import { AppState } from '../types/appstate';
import { ComponentContextShape } from '../types/component';
+import { Feature } from '../types/features';
import { Dict, Extension, Languages, Metric, SysStatus } from '../types/types';
import { CurrentUser } from '../types/users';
import { DEFAULT_METRICS } from './mocks/metrics';
@@ -44,6 +46,7 @@ export interface RenderContext {
languages?: Languages;
currentUser?: CurrentUser;
navigateTo?: string;
+ featureList?: Feature[];
}
export function renderAppWithAdminContext(
@@ -156,6 +159,7 @@ function renderRoutedApp(
navigateTo = indexPath,
metrics = DEFAULT_METRICS,
appState = mockAppState(),
+ featureList = [],
languages = {}
}: RenderContext = {}
): RenderResult {
@@ -167,19 +171,21 @@ function renderRoutedApp(
<IntlProvider defaultLocale="en" locale="en">
<MetricsContext.Provider value={metrics}>
<LanguagesContext.Provider value={languages}>
- <CurrentUserContextProvider currentUser={currentUser}>
- <AppStateContextProvider appState={appState}>
- <IndexationContextProvider>
- <GlobalMessagesContainer />
- <MemoryRouter initialEntries={[path]}>
- <Routes>
- {children}
- <Route path="*" element={<CatchAll />} />
- </Routes>
- </MemoryRouter>
- </IndexationContextProvider>
- </AppStateContextProvider>
- </CurrentUserContextProvider>
+ <AvailableFeaturesContext.Provider value={featureList}>
+ <CurrentUserContextProvider currentUser={currentUser}>
+ <AppStateContextProvider appState={appState}>
+ <IndexationContextProvider>
+ <GlobalMessagesContainer />
+ <MemoryRouter initialEntries={[path]}>
+ <Routes>
+ {children}
+ <Route path="*" element={<CatchAll />} />
+ </Routes>
+ </MemoryRouter>
+ </IndexationContextProvider>
+ </AppStateContextProvider>
+ </CurrentUserContextProvider>
+ </AvailableFeaturesContext.Provider>
</LanguagesContext.Provider>
</MetricsContext.Provider>
</IntlProvider>