aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2022-03-23 18:32:30 +0100
committersonartech <sonartech@sonarsource.com>2022-03-28 20:02:52 +0000
commit63ad64c7c2b365736eb4c9c91a68d9580c549d69 (patch)
treedef5b30f8cd510966f5a0663f1e6210c7463ef05 /server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
parenta39698d0cd444d4e9c56fafb8da4171a3e3454bf (diff)
downloadsonarqube-63ad64c7c2b365736eb4c9c91a68d9580c549d69.tar.gz
sonarqube-63ad64c7c2b365736eb4c9c91a68d9580c549d69.zip
SONAR-16085 Adding IT and change select from activation modal
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx')
-rw-r--r--server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx21
1 files changed, 13 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx b/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
index 92025a107c2..68c07d46158 100644
--- a/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
+++ b/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
@@ -27,12 +27,13 @@ import { createMemoryHistory, Route, RouteComponent, RouteConfig, Router } from
import { Store } from 'redux';
import AppStateContextProvider from '../app/components/app-state/AppStateContextProvider';
import CurrentUserContextProvider from '../app/components/current-user/CurrentUserContextProvider';
+import { LanguagesContext } from '../app/components/languages/LanguagesContext';
import { MetricsContext } from '../app/components/metrics/MetricsContext';
import getStore from '../app/utils/getStore';
import { RouteWithChildRoutes } from '../app/utils/startReactApp';
import { Store as State } from '../store/rootReducer';
import { AppState } from '../types/appstate';
-import { Dict, Metric } from '../types/types';
+import { Dict, Languages, Metric } from '../types/types';
import { CurrentUser } from '../types/users';
import { DEFAULT_METRICS } from './mocks/metrics';
import { mockAppState, mockCurrentUser } from './testMocks';
@@ -42,6 +43,7 @@ interface RenderContext {
store?: Store<State, any>;
history?: History;
appState?: AppState;
+ languages?: Languages;
currentUser?: CurrentUser;
}
@@ -56,7 +58,7 @@ export function renderComponentApp(
export function renderApp(
indexPath: string,
routes: RouteConfig,
- context: RenderContext
+ context?: RenderContext
): RenderResult {
return renderRoutedApp(
<RouteWithChildRoutes path={indexPath} childRoutes={routes} />,
@@ -73,7 +75,8 @@ function renderRoutedApp(
metrics = DEFAULT_METRICS,
store = getStore(),
appState = mockAppState(),
- history = createMemoryHistory()
+ history = createMemoryHistory(),
+ languages = {}
}: RenderContext = {}
): RenderResult {
history.push(`/${indexPath}`);
@@ -82,11 +85,13 @@ function renderRoutedApp(
<IntlProvider defaultLocale="en" locale="en">
<MetricsContext.Provider value={metrics}>
<Provider store={store}>
- <CurrentUserContextProvider currentUser={currentUser}>
- <AppStateContextProvider appState={appState}>
- <Router history={history}>{children}</Router>
- </AppStateContextProvider>
- </CurrentUserContextProvider>
+ <LanguagesContext.Provider value={languages}>
+ <CurrentUserContextProvider currentUser={currentUser}>
+ <AppStateContextProvider appState={appState}>
+ <Router history={history}>{children}</Router>
+ </AppStateContextProvider>
+ </CurrentUserContextProvider>
+ </LanguagesContext.Provider>
</Provider>
</MetricsContext.Provider>
</IntlProvider>