diff options
author | Wouter Admiraal <45544358+wouter-admiraal-sonarsource@users.noreply.github.com> | 2021-08-30 12:10:31 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-08-30 20:08:19 +0000 |
commit | 49789f6a622f402e85a72b9b77b9dfa827785a60 (patch) | |
tree | 065bd83c142248fdb576510da973147fbe3bf6e7 | |
parent | 1e78c066e5eed1752abfbcc91b977703d5dd0c51 (diff) | |
download | sonarqube-49789f6a622f402e85a72b9b77b9dfa827785a60.tar.gz sonarqube-49789f6a622f402e85a72b9b77b9dfa827785a60.zip |
SONAR-12018 Keep users on Measures page when drilling down
159 files changed, 938 insertions, 372 deletions
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx index d3e921899fe..6a4590cd08c 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx @@ -26,8 +26,9 @@ import { getComponentData } from '../../../api/components'; import { getComponentNavigation } from '../../../api/nav'; import { mockProjectAlmBindingConfigurationErrors } from '../../../helpers/mocks/alm-settings'; import { mockBranch, mockMainBranch, mockPullRequest } from '../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../helpers/mocks/component'; import { mockTask } from '../../../helpers/mocks/tasks'; -import { mockAppState, mockComponent, mockLocation, mockRouter } from '../../../helpers/testMocks'; +import { mockAppState, mockLocation, mockRouter } from '../../../helpers/testMocks'; import { waitAndUpdate } from '../../../helpers/testUtils'; import { AlmKeys } from '../../../types/alm-settings'; import { ComponentQualifier } from '../../../types/component'; diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ProjectAdminContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ProjectAdminContainer-test.tsx index 001822909b6..e867f7145ae 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/ProjectAdminContainer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/ProjectAdminContainer-test.tsx @@ -20,7 +20,7 @@ import { mount, shallow } from 'enzyme'; import * as React from 'react'; import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization'; -import { mockComponent } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; import ProjectAdminContainer from '../ProjectAdminContainer'; jest.mock('../../utils/handleRequiredAuthorization', () => { diff --git a/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectAdminPageExtension-test.tsx b/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectAdminPageExtension-test.tsx index 047550a9f43..3219a8192e2 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectAdminPageExtension-test.tsx +++ b/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectAdminPageExtension-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent, mockLocation } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLocation } from '../../../../helpers/testMocks'; import { ProjectAdminPageExtension, ProjectAdminPageExtensionProps diff --git a/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectPageExtension-test.tsx b/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectPageExtension-test.tsx index b79a25a557b..62eeccafae5 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectPageExtension-test.tsx +++ b/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectPageExtension-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockLocation } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLocation } from '../../../../helpers/testMocks'; import ProjectPageExtension, { ProjectPageExtensionProps } from '../ProjectPageExtension'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx index 2b1d7f8a931..f7a10d8085f 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch } from '../../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { ComponentQualifier } from '../../../../../types/component'; import { Breadcrumb } from '../Breadcrumb'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx index 47d8fbc25dc..c1e4fe0e54e 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx @@ -20,8 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockProjectAlmBindingConfigurationErrors } from '../../../../../helpers/mocks/alm-settings'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { mockTask, mockTaskWarning } from '../../../../../helpers/mocks/tasks'; -import { mockComponent } from '../../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../../types/component'; import { TaskStatuses } from '../../../../../types/tasks'; import RecentHistory from '../../../RecentHistory'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx index 9c2ffae48bf..1cafb3663d7 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx @@ -22,8 +22,9 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { Alert } from '../../../../../components/ui/Alert'; import { hasMessage } from '../../../../../helpers/l10n'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { mockTask } from '../../../../../helpers/mocks/tasks'; -import { mockComponent, mockLocation } from '../../../../../helpers/testMocks'; +import { mockLocation } from '../../../../../helpers/testMocks'; import { Task, TaskStatuses, TaskTypes } from '../../../../../types/tasks'; import { ComponentNavBgTaskNotif } from '../ComponentNavBgTaskNotif'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavProjectBindingErrorNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavProjectBindingErrorNotif-test.tsx index fc6b51ad03f..35ca8b06ad1 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavProjectBindingErrorNotif-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavProjectBindingErrorNotif-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { ComponentNavProjectBindingErrorNotif, ComponentNavProjectBindingErrorNotifProps diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Header-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Header-test.tsx index 987d9418a27..56adc77296c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Header-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Header-test.tsx @@ -21,7 +21,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import Favorite from '../../../../../components/controls/Favorite'; import { mockSetOfBranchAndPullRequest } from '../../../../../helpers/mocks/branch-like'; -import { mockComponent, mockCurrentUser } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; +import { mockCurrentUser } from '../../../../../helpers/testMocks'; import { Header, HeaderProps } from '../Header'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/HeaderMeta-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/HeaderMeta-test.tsx index a0ae8cfb150..fa2a4041b2c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/HeaderMeta-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/HeaderMeta-test.tsx @@ -21,8 +21,9 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import HomePageSelect from '../../../../../components/controls/HomePageSelect'; import { mockBranch, mockPullRequest } from '../../../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { mockTaskWarning } from '../../../../../helpers/mocks/tasks'; -import { mockComponent, mockCurrentUser } from '../../../../../helpers/testMocks'; +import { mockCurrentUser } from '../../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../../types/component'; import { getCurrentPage, HeaderMeta, HeaderMetaProps } from '../HeaderMeta'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Menu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Menu-test.tsx index 0599e075ba2..7591d825abf 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Menu-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Menu-test.tsx @@ -24,7 +24,7 @@ import { mockMainBranch, mockPullRequest } from '../../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { ComponentQualifier } from '../../../../../types/component'; import { Menu } from '../Menu'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/BranchLikeNavigation-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/BranchLikeNavigation-test.tsx index 7f2f4b407e2..ed6b180e931 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/BranchLikeNavigation-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/BranchLikeNavigation-test.tsx @@ -21,7 +21,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import Toggler from '../../../../../../components/controls/Toggler'; import { mockSetOfBranchAndPullRequest } from '../../../../../../helpers/mocks/branch-like'; -import { mockAppState, mockComponent } from '../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../helpers/mocks/component'; +import { mockAppState } from '../../../../../../helpers/testMocks'; import { click } from '../../../../../../helpers/testUtils'; import { BranchLikeNavigation, BranchLikeNavigationProps } from '../BranchLikeNavigation'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLike-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLike-test.tsx index 7da6e02c498..baa825330d8 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLike-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLike-test.tsx @@ -24,7 +24,7 @@ import { mockProjectGitLabBindingResponse } from '../../../../../../helpers/mocks/alm-settings'; import { mockMainBranch } from '../../../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../helpers/mocks/component'; import { ComponentQualifier } from '../../../../../../types/component'; import { CurrentBranchLike, CurrentBranchLikeProps } from '../CurrentBranchLike'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx index a6268c83505..f0ca9926d3c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx @@ -26,7 +26,8 @@ import { mockPullRequest, mockSetOfBranchAndPullRequest } from '../../../../../../helpers/mocks/branch-like'; -import { mockComponent, mockRouter } from '../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../helpers/mocks/component'; +import { mockRouter } from '../../../../../../helpers/testMocks'; import { click, mockEvent } from '../../../../../../helpers/testUtils'; import { Menu } from '../Menu'; import { MenuItemList } from '../MenuItemList'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItem-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItem-test.tsx index fb41672dbed..c1260ef0992 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItem-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItem-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch, mockPullRequest } from '../../../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../helpers/mocks/component'; import { click } from '../../../../../../helpers/testUtils'; import { MenuItem, MenuItemProps } from '../MenuItem'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItemList-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItemList-test.tsx index 9f9f1830f1a..473bc8c2681 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItemList-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItemList-test.tsx @@ -24,7 +24,7 @@ import { mockPullRequest, mockSetOfBranchAndPullRequest } from '../../../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../helpers/mocks/component'; import { MenuItemList, MenuItemListProps } from '../MenuItemList'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformation-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformation-test.tsx index b6d8ff63be3..856efeeb83c 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformation-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformation-test.tsx @@ -19,12 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { - mockComponent, - mockCurrentUser, - mockLoggedInUser, - mockMetric -} from '../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../helpers/mocks/component'; +import { mockCurrentUser, mockLoggedInUser, mockMetric } from '../../../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../../../helpers/testUtils'; import { ProjectInformation } from '../ProjectInformation'; import { ProjectInformationPages } from '../ProjectInformationPages'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformationRenderer-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformationRenderer-test.tsx index b34b1039797..80bfd0483df 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformationRenderer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformationRenderer-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../helpers/mocks/component'; import { ProjectInformationRenderer, ProjectInformationRendererProps diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaSize-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaSize-test.tsx index 13f1f82f6de..2042cb04c41 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaSize-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaSize-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent, mockMeasure } from '../../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../../helpers/mocks/component'; +import { mockMeasure } from '../../../../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../../../../types/component'; import { MetricKey } from '../../../../../../../types/metrics'; import MetaSize, { MetaSizeProps } from '../MetaSize'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTags-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTags-test.tsx index b83a5cc290e..59de28e4ba6 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTags-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTags-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { setApplicationTags, setProjectTags } from '../../../../../../../api/components'; -import { mockComponent } from '../../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../../helpers/mocks/component'; import { ComponentQualifier } from '../../../../../../../types/component'; import MetaTags from '../MetaTags'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/__tests__/ProjectNotifications-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/__tests__/ProjectNotifications-test.tsx index 2e33d89a858..45076ab677e 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/__tests__/ProjectNotifications-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/__tests__/ProjectNotifications-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../../../helpers/mocks/component'; import { ProjectNotifications } from '../ProjectNotifications'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/apps/application-settings/__tests__/ApplicationSettingsApp-test.tsx b/server/sonar-web/src/main/js/apps/application-settings/__tests__/ApplicationSettingsApp-test.tsx index 08a39bee4cc..77f8c981da3 100644 --- a/server/sonar-web/src/main/js/apps/application-settings/__tests__/ApplicationSettingsApp-test.tsx +++ b/server/sonar-web/src/main/js/apps/application-settings/__tests__/ApplicationSettingsApp-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { setSimpleSettingValue } from '../../../api/settings'; -import { mockComponent } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; import { waitAndUpdate } from '../../../helpers/testUtils'; import { SettingsKey } from '../../../types/settings'; import ApplicationSettingsApp from '../ApplicationSettingsApp'; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stats-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stats-test.tsx index b0915472c99..c4da39f3186 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stats-test.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stats-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import Stats, { Props } from '../Stats'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/AppCode-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/AppCode-test.tsx index beef71fc318..346e5028355 100644 --- a/server/sonar-web/src/main/js/apps/code/components/__tests__/AppCode-test.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/AppCode-test.tsx @@ -20,12 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockPullRequest } from '../../../../helpers/mocks/branch-like'; -import { - mockComponent, - mockComponentMeasure, - mockIssue, - mockRouter -} from '../../../../helpers/testMocks'; +import { mockComponent, mockComponentMeasure } from '../../../../helpers/mocks/component'; +import { mockIssue, mockRouter } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import { ComponentQualifier } from '../../../../types/component'; import { loadMoreChildren, retrieveComponent } from '../../utils'; diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/Component-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/Component-test.tsx index 42c7322c089..1bdd69d6c41 100644 --- a/server/sonar-web/src/main/js/apps/code/components/__tests__/Component-test.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/Component-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponentMeasure, mockMetric } from '../../../../helpers/testMocks'; +import { mockComponentMeasure } from '../../../../helpers/mocks/component'; +import { mockMetric } from '../../../../helpers/testMocks'; import { Component } from '../Component'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentMeasure-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentMeasure-test.tsx index b0e029c4908..2de1b93fbef 100644 --- a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentMeasure-test.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentMeasure-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponentMeasure, mockMeasure, mockMetric } from '../../../../helpers/testMocks'; +import { mockComponentMeasure } from '../../../../helpers/mocks/component'; +import { mockMeasure, mockMetric } from '../../../../helpers/testMocks'; import ComponentMeasure from '../ComponentMeasure'; it('renders correctly', () => { diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentName-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentName-test.tsx index 7c1724c95fc..049c3ccc248 100644 --- a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentName-test.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentName-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponentMeasure } from '../../../../helpers/testMocks'; +import { mockComponentMeasure } from '../../../../helpers/mocks/component'; import ComponentName, { getTooltip, mostCommonPrefix, Props } from '../ComponentName'; describe('#getTooltip', () => { diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentsHeader-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentsHeader-test.tsx index 01c89144175..3c06d6b4f7e 100644 --- a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentsHeader-test.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentsHeader-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import ComponentsHeader from '../ComponentsHeader'; it('renders correctly for projects', () => { diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx index a117429d6fa..c5c6b915305 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx @@ -31,11 +31,12 @@ import { RequestData } from '../../../helpers/request'; import { scrollToElement } from '../../../helpers/scrolling'; import { getProjectUrl } from '../../../helpers/urls'; import { BranchLike } from '../../../types/branch-like'; +import { MeasurePageView } from '../../../types/measures'; import { MetricKey } from '../../../types/metrics'; import { complementary } from '../config/complementary'; import FilesView from '../drilldown/FilesView'; import TreeMapView from '../drilldown/TreeMapView'; -import { enhanceComponent, isFileType, isViewType, Query, View } from '../utils'; +import { enhanceComponent, isFileType, isViewType, Query } from '../utils'; import Breadcrumbs from './Breadcrumbs'; import MeasureContentHeader from './MeasureContentHeader'; import MeasureHeader from './MeasureHeader'; @@ -51,7 +52,7 @@ interface Props { router: InjectedRouter; selected?: string; updateQuery: (query: Partial<Query>) => void; - view: View; + view: MeasurePageView; } interface State { @@ -170,7 +171,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> { }; getComponentRequestParams( - view: View, + view: MeasurePageView, metric: Pick<T.Metric, 'key' | 'direction'>, options: Object = {} ) { @@ -218,7 +219,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> { }); }; - updateView = (view: View) => { + updateView = (view: MeasurePageView) => { this.props.updateQuery({ view }); }; diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx index c6860eb3066..43da92b6dcb 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx @@ -23,13 +23,14 @@ import ListIcon from '../../../components/icons/ListIcon'; import TreeIcon from '../../../components/icons/TreeIcon'; import TreemapIcon from '../../../components/icons/TreemapIcon'; import { translate } from '../../../helpers/l10n'; -import { hasList, hasTree, hasTreemap, View } from '../utils'; +import { MeasurePageView } from '../../../types/measures'; +import { hasList, hasTree, hasTreemap } from '../utils'; interface Props { className?: string; metric: T.Metric; - handleViewChange: (view: View) => void; - view: View; + handleViewChange: (view: MeasurePageView) => void; + view: MeasurePageView; } export default class MeasureViewSelect extends React.PureComponent<Props> { @@ -61,7 +62,7 @@ export default class MeasureViewSelect extends React.PureComponent<Props> { }; handleChange = (option: { value: string }) => { - return this.props.handleViewChange(option.value as View); + return this.props.handleViewChange(option.value as MeasurePageView); }; renderOption = (option: { icon: JSX.Element; label: string }) => { diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx index 9c9ae1d407e..c805df0da81 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx @@ -21,7 +21,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { getMeasuresWithPeriod } from '../../../../api/measures'; import { mockMainBranch, mockPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockIssue, mockLocation, mockRouter } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockIssue, mockLocation, mockRouter } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import { App } from '../App'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureContent-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureContent-test.tsx index d89eb1f0c04..1071d5f1fba 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureContent-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureContent-test.tsx @@ -20,8 +20,9 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { getComponentTree } from '../../../../api/components'; +import { mockComponentMeasure } from '../../../../helpers/mocks/component'; import { scrollToElement } from '../../../../helpers/scrolling'; -import { mockComponentMeasure, mockRouter } from '../../../../helpers/testMocks'; +import { mockRouter } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import MeasureContent from '../MeasureContent'; @@ -30,7 +31,7 @@ jest.mock('../../../../helpers/scrolling', () => ({ })); jest.mock('../../../../api/components', () => { - const { mockComponentMeasure } = jest.requireActual('../../../../helpers/testMocks'); + const { mockComponentMeasure } = jest.requireActual('../../../../helpers/mocks/component'); return { getComponentTree: jest.fn().mockResolvedValue({ paging: { pageIndex: 1, pageSize: 500, total: 2 }, diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureOverview-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureOverview-test.tsx index 77923e3f982..4d368739eb1 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureOverview-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureOverview-test.tsx @@ -23,9 +23,11 @@ import { keyBy } from 'lodash'; import * as React from 'react'; import { getComponentLeaves } from '../../../../api/components'; import { mockBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponentMeasureEnhanced } from '../../../../helpers/mocks/component'; import { mockComponentMeasure, + mockComponentMeasureEnhanced +} from '../../../../helpers/mocks/component'; +import { mockMeasure, mockMeasureEnhanced, mockMetric, diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.tsx index 161f47f2a34..302bf0bf71c 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.tsx @@ -17,18 +17,34 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockMetric } from '../../../../helpers/testMocks'; +import { MetricKey } from '../../../../types/metrics'; import MeasureViewSelect from '../MeasureViewSelect'; -it('should display correctly with treemap option', () => { +it('should render correctly', () => { + expect( + shallowRender({ metric: mockMetric({ key: MetricKey.releasability_rating }) }) + ).toMatchSnapshot('has no list'); expect( - shallow( - <MeasureViewSelect - handleViewChange={() => {}} - metric={{ type: 'PERCENT' } as T.Metric} - view="tree" - /> - ) - ).toMatchSnapshot(); + shallowRender({ metric: mockMetric({ key: MetricKey.alert_status, type: 'LEVEL' }) }) + ).toMatchSnapshot('has no tree'); + expect(shallowRender({ metric: mockMetric({ type: 'RATING' }) })).toMatchSnapshot( + 'has no treemap' + ); }); + +it('should correctly trigger a selection change', () => { + const handleViewChange = jest.fn(); + const wrapper = shallowRender({ handleViewChange }); + wrapper.instance().handleChange({ value: 'list' }); + expect(handleViewChange).toBeCalledWith('list'); +}); + +function shallowRender(props: Partial<MeasureViewSelect['props']> = {}) { + return shallow<MeasureViewSelect>( + <MeasureViewSelect metric={mockMetric()} handleViewChange={jest.fn()} view="list" {...props} /> + ); +} diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureViewSelect-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureViewSelect-test.tsx.snap index bc440003070..29fe3dbd9eb 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureViewSelect-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureViewSelect-test.tsx.snap @@ -1,6 +1,53 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`should display correctly with treemap option 1`] = ` +exports[`should render correctly: has no list 1`] = ` +<Select + autoBlur={true} + clearable={false} + onChange={[Function]} + optionRenderer={[Function]} + options={ + Array [ + Object { + "icon": <TreeIcon />, + "label": "component_measures.tab.tree", + "value": "tree", + }, + Object { + "icon": <TreemapIcon />, + "label": "component_measures.tab.treemap", + "value": "treemap", + }, + ] + } + searchable={false} + value="list" + valueRenderer={[Function]} +/> +`; + +exports[`should render correctly: has no tree 1`] = ` +<Select + autoBlur={true} + clearable={false} + onChange={[Function]} + optionRenderer={[Function]} + options={ + Array [ + Object { + "icon": <ListIcon />, + "label": "component_measures.tab.list", + "value": "list", + }, + ] + } + searchable={false} + value="list" + valueRenderer={[Function]} +/> +`; + +exports[`should render correctly: has no treemap 1`] = ` <Select autoBlur={true} clearable={false} @@ -26,7 +73,7 @@ exports[`should display correctly with treemap option 1`] = ` ] } searchable={false} - value="tree" + value="list" valueRenderer={[Function]} /> `; diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx index 7a5e0cf70d5..9b81111a7db 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx @@ -17,123 +17,113 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { LocationDescriptor } from 'history'; import * as React from 'react'; import { Link } from 'react-router'; import BranchIcon from '../../../components/icons/BranchIcon'; import LinkIcon from '../../../components/icons/LinkIcon'; import QualifierIcon from '../../../components/icons/QualifierIcon'; import { translate } from '../../../helpers/l10n'; -import { isDiffMetric } from '../../../helpers/measures'; import { splitPath } from '../../../helpers/path'; import { getBranchLikeUrl, getComponentDrilldownUrlWithSelection, - getComponentSecurityHotspotsUrl, getProjectUrl } from '../../../helpers/urls'; import { BranchLike } from '../../../types/branch-like'; -import { isFileType, isSecurityReviewMetric, View } from '../utils'; +import { + ComponentQualifier, + isApplication, + isPortfolioLike, + isProject +} from '../../../types/component'; +import { MeasurePageView } from '../../../types/measures'; +import { MetricKey } from '../../../types/metrics'; -interface Props { +export interface ComponentCellProps { branchLike?: BranchLike; component: T.ComponentMeasureEnhanced; - onClick: (component: string) => void; metric: T.Metric; rootComponent: T.ComponentMeasure; - view: View; + view: MeasurePageView; } -export default class ComponentCell extends React.PureComponent<Props> { - handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => { - const isLeftClickEvent = event.button === 0; - const isModifiedEvent = !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); +export default function ComponentCell(props: ComponentCellProps) { + const { branchLike, component, metric, rootComponent, view } = props; - if (isLeftClickEvent && !isModifiedEvent) { - event.preventDefault(); - this.props.onClick(this.props.component.key); - } - }; + let head = ''; + let tail = component.name; - renderInner(componentKey: string) { - const { component } = this.props; - let head = ''; - let tail = component.name; + if ( + view === 'list' && + ([ + ComponentQualifier.File, + ComponentQualifier.TestFile, + ComponentQualifier.Directory + ] as string[]).includes(component.qualifier) && + component.path + ) { + ({ head, tail } = splitPath(component.path)); + } + let path: LocationDescriptor; + if (component.refKey) { if ( - this.props.view === 'list' && - ['FIL', 'UTS', 'DIR'].includes(component.qualifier) && - component.path + !isPortfolioLike(component.qualifier) && + ([MetricKey.releasability_rating, MetricKey.alert_status] as string[]).includes(metric.key) ) { - ({ head, tail } = splitPath(component.path)); + path = isApplication(component.qualifier) + ? getProjectUrl(component.refKey, component.branch) + : getBranchLikeUrl(component.refKey, branchLike); + } else if (isProject(component.qualifier) && metric.key === MetricKey.projects) { + path = getBranchLikeUrl(component.refKey, branchLike); + } else { + path = getComponentDrilldownUrlWithSelection( + component.refKey, + '', + metric.key, + branchLike, + view + ); } - - const isApp = this.props.rootComponent.qualifier === 'APP'; - - return ( - <span title={componentKey}> - <QualifierIcon className="little-spacer-right" qualifier={component.qualifier} /> - {head.length > 0 && <span className="note">{head}/</span>} - <span>{tail}</span> - {isApp && - (component.branch ? ( - <> - <BranchIcon className="spacer-left little-spacer-right" /> - <span className="note">{component.branch}</span> - </> - ) : ( - <span className="spacer-left badge">{translate('branches.main_branch')}</span> - ))} - </span> + } else { + path = getComponentDrilldownUrlWithSelection( + rootComponent.key, + component.key, + metric.key, + branchLike, + view ); } - render() { - const { branchLike, component, metric, rootComponent } = this.props; - - let hotspotsUrl; - if (isFileType(component) && isSecurityReviewMetric(metric.key)) { - hotspotsUrl = getComponentSecurityHotspotsUrl(this.props.rootComponent.key, { - file: component.path, - sinceLeakPeriod: isDiffMetric(metric.key) ? 'true' : undefined - }); - } - - return ( - <td className="measure-details-component-cell"> - <div className="text-ellipsis"> - {!component.refKey ? ( - <Link - className="link-no-underline" - to={ - hotspotsUrl || - getComponentDrilldownUrlWithSelection( - rootComponent.key, - component.key, - metric.key, - branchLike - ) - } - id={'component-measures-component-link-' + component.key} - onClick={hotspotsUrl ? undefined : this.handleClick}> - {this.renderInner(component.key)} - </Link> - ) : ( - <Link - className="link-no-underline" - id={'component-measures-component-link-' + component.refKey} - to={ - this.props.rootComponent.qualifier === 'APP' - ? getProjectUrl(component.refKey, component.branch) - : getBranchLikeUrl(component.refKey, branchLike) - }> - <span className="big-spacer-right"> - <LinkIcon /> - </span> - {this.renderInner(component.refKey)} - </Link> + return ( + <td className="measure-details-component-cell"> + <div className="text-ellipsis"> + <Link + className="link-no-underline" + to={path} + id={'component-measures-component-link-' + component.key}> + {component.refKey && ( + <span className="big-spacer-right"> + <LinkIcon /> + </span> )} - </div> - </td> - ); - } + <span title={component.key}> + <QualifierIcon className="little-spacer-right" qualifier={component.qualifier} /> + {head.length > 0 && <span className="note">{head}/</span>} + <span>{tail}</span> + {isApplication(rootComponent.qualifier) && + (component.branch ? ( + <> + <BranchIcon className="spacer-left little-spacer-right" /> + <span className="note">{component.branch}</span> + </> + ) : ( + <span className="spacer-left badge">{translate('branches.main_branch')}</span> + ))} + </span> + </Link> + </div> + </td> + ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx index 1bd16bccfbe..907f671a76f 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx @@ -20,20 +20,19 @@ import * as React from 'react'; import { getLocalizedMetricName } from '../../../helpers/l10n'; import { BranchLike } from '../../../types/branch-like'; +import { MeasurePageView } from '../../../types/measures'; import { complementary } from '../config/complementary'; -import { View } from '../utils'; import ComponentsListRow from './ComponentsListRow'; import EmptyResult from './EmptyResult'; interface Props { branchLike?: BranchLike; components: T.ComponentMeasureEnhanced[]; - onClick: (component: string) => void; metric: T.Metric; metrics: T.Dict<T.Metric>; rootComponent: T.ComponentMeasure; selectedComponent?: string; - view: View; + view: MeasurePageView; } export default function ComponentsList({ components, metric, metrics, ...props }: Props) { diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx index b1749e548f5..c29be3db951 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx @@ -20,7 +20,7 @@ import * as classNames from 'classnames'; import * as React from 'react'; import { BranchLike } from '../../../types/branch-like'; -import { View } from '../utils'; +import { MeasurePageView } from '../../../types/measures'; import ComponentCell from './ComponentCell'; import MeasureCell from './MeasureCell'; @@ -28,11 +28,10 @@ interface Props { branchLike?: BranchLike; component: T.ComponentMeasureEnhanced; isSelected: boolean; - onClick: (component: string) => void; otherMetrics: T.Metric[]; metric: T.Metric; rootComponent: T.ComponentMeasure; - view: View; + view: MeasurePageView; } export default function ComponentsListRow(props: Props) { @@ -50,7 +49,6 @@ export default function ComponentsListRow(props: Props) { branchLike={branchLike} component={component} metric={props.metric} - onClick={props.onClick} rootComponent={rootComponent} view={props.view} /> diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx index 828bad17a29..8e6271ea845 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx @@ -27,7 +27,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; import { formatMeasure, isDiffMetric, isPeriodBestValue } from '../../../helpers/measures'; import { scrollToElement } from '../../../helpers/scrolling'; import { BranchLike } from '../../../types/branch-like'; -import { View } from '../utils'; +import { MeasurePageView } from '../../../types/measures'; import ComponentsList from './ComponentsList'; interface Props { @@ -44,7 +44,7 @@ interface Props { rootComponent: T.ComponentMeasure; selectedKey?: string; selectedIdx?: number; - view: View; + view: MeasurePageView; } interface State { @@ -173,7 +173,6 @@ export default class FilesView extends React.PureComponent<Props, State> { components={filteredComponents} metric={this.props.metric} metrics={this.props.metrics} - onClick={this.props.handleOpen} rootComponent={this.props.rootComponent} selectedComponent={this.props.selectedKey} view={this.props.view} diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/BubbleChart-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/BubbleChart-test.tsx index 4673a98f943..45a67de0058 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/BubbleChart-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/BubbleChart-test.tsx @@ -21,12 +21,8 @@ import { shallow } from 'enzyme'; import { keyBy } from 'lodash'; import * as React from 'react'; import OriginalBubbleChart from '../../../../components/charts/BubbleChart'; -import { - mockComponentMeasure, - mockMeasure, - mockMetric, - mockPaging -} from '../../../../helpers/testMocks'; +import { mockComponentMeasure } from '../../../../helpers/mocks/component'; +import { mockMeasure, mockMetric, mockPaging } from '../../../../helpers/testMocks'; import { MetricKey } from '../../../../types/metrics'; import { enhanceComponent } from '../../utils'; import BubbleChart from '../BubbleChart'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx index 981ef5a8bbe..ccb196e14b8 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx @@ -19,31 +19,104 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponentMeasure, mockMetric } from '../../../../helpers/testMocks'; +import { mockBranch, mockPullRequest } from '../../../../helpers/mocks/branch-like'; +import { + mockComponentMeasure, + mockComponentMeasureEnhanced +} from '../../../../helpers/mocks/component'; +import { mockMetric } from '../../../../helpers/testMocks'; +import { ComponentQualifier } from '../../../../types/component'; import { MetricKey } from '../../../../types/metrics'; import { enhanceComponent } from '../../utils'; -import ComponentCell from '../ComponentCell'; +import ComponentCell, { ComponentCellProps } from '../ComponentCell'; it('should render correctly', () => { expect(shallowRender()).toMatchSnapshot('default'); - expect(shallowRender({}, MetricKey.security_hotspots)).toMatchSnapshot('security review domain'); - - const metric = mockMetric({ key: MetricKey.bugs }); expect( shallowRender({ - component: enhanceComponent( - mockComponentMeasure(false, { refKey: 'project-key' }), - { key: metric.key }, - { [metric.key]: metric } - ) + rootComponent: mockComponentMeasure(false, { qualifier: ComponentQualifier.Application }) + }) + ).toMatchSnapshot('root component is application, component is on main branch'); + expect( + shallowRender({ + rootComponent: mockComponentMeasure(false, { qualifier: ComponentQualifier.Application }), + component: mockComponentMeasureEnhanced({ branch: 'develop' }) + }) + ).toMatchSnapshot('root component is application, component has branch'); + expect( + shallowRender({ component: mockComponentMeasureEnhanced({ refKey: 'project-key' }) }) + ).toMatchSnapshot('ref project component'); + expect( + shallowRender( + { + component: mockComponentMeasureEnhanced({ + refKey: 'project-key', + qualifier: ComponentQualifier.Project + }), + branchLike: mockBranch() + }, + MetricKey.releasability_rating + ) + ).toMatchSnapshot('ref project component, releasability metric'); + expect( + shallowRender( + { + component: mockComponentMeasureEnhanced({ + refKey: 'app-key', + qualifier: ComponentQualifier.Application + }), + branchLike: mockBranch() + }, + MetricKey.projects + ) + ).toMatchSnapshot('ref application component, projects'); + expect( + shallowRender( + { + component: mockComponentMeasureEnhanced({ + refKey: 'project-key', + qualifier: ComponentQualifier.Project + }), + branchLike: mockBranch() + }, + MetricKey.projects + ) + ).toMatchSnapshot('ref project component, projects'); + expect( + shallowRender( + { + component: mockComponentMeasureEnhanced({ + refKey: 'app-key', + qualifier: ComponentQualifier.Application + }), + branchLike: mockPullRequest() + }, + MetricKey.alert_status + ) + ).toMatchSnapshot('ref application component, alert_status metric'); + expect( + shallowRender( + { + component: mockComponentMeasureEnhanced({ + refKey: 'vw-key', + qualifier: ComponentQualifier.Portfolio + }), + branchLike: mockPullRequest() + }, + MetricKey.alert_status + ) + ).toMatchSnapshot('ref portfolio component, alert_status metric'); + expect( + shallowRender({ + component: mockComponentMeasureEnhanced({ + key: 'svw-bar', + qualifier: ComponentQualifier.SubPortfolio + }) }) - ).toMatchSnapshot('ref component'); + ).toMatchSnapshot('sub-portfolio component'); }); -function shallowRender( - overrides: Partial<ComponentCell['props']> = {}, - metricKey = MetricKey.bugs -) { +function shallowRender(overrides: Partial<ComponentCellProps> = {}, metricKey = MetricKey.bugs) { const metric = mockMetric({ key: metricKey }); const component = enhanceComponent( mockComponentMeasure(true, { @@ -53,11 +126,10 @@ function shallowRender( { [metric.key]: metric } ); - return shallow<ComponentCell>( + return shallow<ComponentCellProps>( <ComponentCell component={component} metric={metric} - onClick={jest.fn()} rootComponent={mockComponentMeasure(false)} view="list" {...overrides} diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentList-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentList-test.tsx index bbefdc42480..478ab794bd0 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentList-test.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentList-test.tsx @@ -44,7 +44,6 @@ it('should renders correctly', () => { components={COMPONENTS} metric={METRICS.new_bugs} metrics={METRICS} - onClick={jest.fn()} rootComponent={COMPONENTS[0]} view="tree" /> @@ -59,7 +58,6 @@ it('should renders empty', () => { components={[]} metric={METRICS.new_bugs} metrics={METRICS} - onClick={jest.fn()} rootComponent={COMPONENTS[0]} view="tree" /> @@ -74,7 +72,6 @@ it('should renders with multiple measures', () => { components={COMPONENTS} metric={METRICS.coverage} metrics={METRICS} - onClick={jest.fn()} rootComponent={COMPONENTS[0]} view="tree" /> diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentCell-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentCell-test.tsx.snap index 21d4106dec4..474ada97872 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentCell-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentCell-test.tsx.snap @@ -10,7 +10,6 @@ exports[`should render correctly: default 1`] = ` <Link className="link-no-underline" id="component-measures-component-link-foo:src/index.tsx" - onClick={[Function]} onlyActiveOnIndex={false} style={Object {}} to={ @@ -20,6 +19,7 @@ exports[`should render correctly: default 1`] = ` "id": "foo", "metric": "bugs", "selected": "foo:src/index.tsx", + "view": "list", }, } } @@ -46,7 +46,7 @@ exports[`should render correctly: default 1`] = ` </td> `; -exports[`should render correctly: ref component 1`] = ` +exports[`should render correctly: ref application component, alert_status metric 1`] = ` <td className="measure-details-component-cell" > @@ -55,7 +55,7 @@ exports[`should render correctly: ref component 1`] = ` > <Link className="link-no-underline" - id="component-measures-component-link-project-key" + id="component-measures-component-link-foo" onlyActiveOnIndex={false} style={Object {}} to={ @@ -63,7 +63,141 @@ exports[`should render correctly: ref component 1`] = ` "pathname": "/dashboard", "query": Object { "branch": undefined, + "id": "app-key", + }, + } + } + > + <span + className="big-spacer-right" + > + <LinkIcon /> + </span> + <span + title="foo" + > + <QualifierIcon + className="little-spacer-right" + qualifier="APP" + /> + <span> + Foo + </span> + </span> + </Link> + </div> +</td> +`; + +exports[`should render correctly: ref application component, projects 1`] = ` +<td + className="measure-details-component-cell" +> + <div + className="text-ellipsis" + > + <Link + className="link-no-underline" + id="component-measures-component-link-foo" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/component_measures", + "query": Object { + "branch": "branch-6.7", + "id": "app-key", + "metric": "projects", + "view": "list", + }, + } + } + > + <span + className="big-spacer-right" + > + <LinkIcon /> + </span> + <span + title="foo" + > + <QualifierIcon + className="little-spacer-right" + qualifier="APP" + /> + <span> + Foo + </span> + </span> + </Link> + </div> +</td> +`; + +exports[`should render correctly: ref portfolio component, alert_status metric 1`] = ` +<td + className="measure-details-component-cell" +> + <div + className="text-ellipsis" + > + <Link + className="link-no-underline" + id="component-measures-component-link-foo" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/component_measures", + "query": Object { + "id": "vw-key", + "metric": "alert_status", + "pullRequest": "1001", + "view": "list", + }, + } + } + > + <span + className="big-spacer-right" + > + <LinkIcon /> + </span> + <span + title="foo" + > + <QualifierIcon + className="little-spacer-right" + qualifier="VW" + /> + <span> + Foo + </span> + </span> + </Link> + </div> +</td> +`; + +exports[`should render correctly: ref project component 1`] = ` +<td + className="measure-details-component-cell" +> + <div + className="text-ellipsis" + > + <Link + className="link-no-underline" + id="component-measures-component-link-foo" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/component_measures", + "query": Object { "id": "project-key", + "metric": "bugs", + "view": "list", }, } } @@ -74,7 +208,7 @@ exports[`should render correctly: ref component 1`] = ` <LinkIcon /> </span> <span - title="project-key" + title="foo" > <QualifierIcon className="little-spacer-right" @@ -89,7 +223,141 @@ exports[`should render correctly: ref component 1`] = ` </td> `; -exports[`should render correctly: security review domain 1`] = ` +exports[`should render correctly: ref project component, projects 1`] = ` +<td + className="measure-details-component-cell" +> + <div + className="text-ellipsis" + > + <Link + className="link-no-underline" + id="component-measures-component-link-foo" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/dashboard", + "query": Object { + "branch": "branch-6.7", + "id": "project-key", + }, + } + } + > + <span + className="big-spacer-right" + > + <LinkIcon /> + </span> + <span + title="foo" + > + <QualifierIcon + className="little-spacer-right" + qualifier="TRK" + /> + <span> + Foo + </span> + </span> + </Link> + </div> +</td> +`; + +exports[`should render correctly: ref project component, releasability metric 1`] = ` +<td + className="measure-details-component-cell" +> + <div + className="text-ellipsis" + > + <Link + className="link-no-underline" + id="component-measures-component-link-foo" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/dashboard", + "query": Object { + "branch": "branch-6.7", + "id": "project-key", + }, + } + } + > + <span + className="big-spacer-right" + > + <LinkIcon /> + </span> + <span + title="foo" + > + <QualifierIcon + className="little-spacer-right" + qualifier="TRK" + /> + <span> + Foo + </span> + </span> + </Link> + </div> +</td> +`; + +exports[`should render correctly: root component is application, component has branch 1`] = ` +<td + className="measure-details-component-cell" +> + <div + className="text-ellipsis" + > + <Link + className="link-no-underline" + id="component-measures-component-link-foo" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/component_measures", + "query": Object { + "id": "foo", + "metric": "bugs", + "selected": "foo", + "view": "list", + }, + } + } + > + <span + title="foo" + > + <QualifierIcon + className="little-spacer-right" + qualifier="TRK" + /> + <span> + Foo + </span> + <BranchIcon + className="spacer-left little-spacer-right" + /> + <span + className="note" + > + develop + </span> + </span> + </Link> + </div> +</td> +`; + +exports[`should render correctly: root component is application, component is on main branch 1`] = ` <td className="measure-details-component-cell" > @@ -103,15 +371,12 @@ exports[`should render correctly: security review domain 1`] = ` style={Object {}} to={ Object { - "pathname": "/security_hotspots", + "pathname": "/component_measures", "query": Object { - "assignedToMe": undefined, - "branch": undefined, - "file": "src/index.tsx", - "hotspots": undefined, "id": "foo", - "pullRequest": undefined, - "sinceLeakPeriod": undefined, + "metric": "bugs", + "selected": "foo:src/index.tsx", + "view": "list", }, } } @@ -132,6 +397,51 @@ exports[`should render correctly: security review domain 1`] = ` <span> index.tsx </span> + <span + className="spacer-left badge" + > + branches.main_branch + </span> + </span> + </Link> + </div> +</td> +`; + +exports[`should render correctly: sub-portfolio component 1`] = ` +<td + className="measure-details-component-cell" +> + <div + className="text-ellipsis" + > + <Link + className="link-no-underline" + id="component-measures-component-link-svw-bar" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/component_measures", + "query": Object { + "id": "foo", + "metric": "bugs", + "selected": "svw-bar", + "view": "list", + }, + } + } + > + <span + title="svw-bar" + > + <QualifierIcon + className="little-spacer-right" + qualifier="SVW" + /> + <span> + Foo + </span> </span> </Link> </div> diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentList-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentList-test.tsx.snap index eee4db08dc2..85f717ade47 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentList-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/ComponentList-test.tsx.snap @@ -24,7 +24,6 @@ exports[`should renders correctly 1`] = ` "type": "INT", } } - onClick={[MockFunction]} otherMetrics={Array []} rootComponent={ Object { @@ -102,7 +101,6 @@ exports[`should renders with multiple measures 1`] = ` "type": "PERCENT", } } - onClick={[MockFunction]} otherMetrics={ Array [ Object { diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/FilesView-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/FilesView-test.tsx.snap index edf84eb575e..75f52aa9974 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/FilesView-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/__snapshots__/FilesView-test.tsx.snap @@ -31,7 +31,6 @@ exports[`should render with best values hidden 1`] = ` }, } } - onClick={[MockFunction]} rootComponent={ Object { "key": "parent", @@ -92,7 +91,6 @@ exports[`should renders correctly 1`] = ` }, } } - onClick={[MockFunction]} rootComponent={ Object { "key": "parent", diff --git a/server/sonar-web/src/main/js/apps/component-measures/utils.ts b/server/sonar-web/src/main/js/apps/component-measures/utils.ts index a36aaf2a613..5b95979165e 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/utils.ts +++ b/server/sonar-web/src/main/js/apps/component-measures/utils.ts @@ -25,15 +25,14 @@ import { getDisplayMetrics, isDiffMetric } from '../../helpers/measures'; import { cleanQuery, parseAsString, serializeString } from '../../helpers/query'; import { BranchLike } from '../../types/branch-like'; import { ComponentQualifier } from '../../types/component'; +import { MeasurePageView } from '../../types/measures'; import { MetricKey } from '../../types/metrics'; import { bubbles } from './config/bubbles'; import { domains } from './config/domains'; -export type View = 'list' | 'tree' | 'treemap'; - export const BUBBLES_FETCH_LIMIT = 500; export const PROJECT_OVERVEW = 'project_overview'; -export const DEFAULT_VIEW: View = 'tree'; +export const DEFAULT_VIEW: MeasurePageView = 'tree'; export const DEFAULT_METRIC = PROJECT_OVERVEW; export const KNOWN_DOMAINS = [ 'Releasability', @@ -212,8 +211,8 @@ export function isProjectOverview(metric: string) { return metric === PROJECT_OVERVEW; } -function parseView(metric: string, rawView?: string): View { - const view = (parseAsString(rawView) || DEFAULT_VIEW) as View; +function parseView(metric: string, rawView?: string): MeasurePageView { + const view = (parseAsString(rawView) || DEFAULT_VIEW) as MeasurePageView; if (!hasTree(metric)) { return 'list'; } else if (view === 'list' && !hasList(metric)) { @@ -225,7 +224,7 @@ function parseView(metric: string, rawView?: string): View { export interface Query { metric: string; selected?: string; - view: View; + view: MeasurePageView; } export const parseQuery = memoize( diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx index 96dfacafa71..a86def001bb 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/App-test.tsx @@ -23,6 +23,7 @@ import * as React from 'react'; import handleRequiredAuthentication from '../../../../helpers/handleRequiredAuthentication'; import { KeyCodes } from '../../../../helpers/keycodes'; import { mockPullRequest } from '../../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { addSideBarClass, addWhitePageClass, @@ -30,7 +31,6 @@ import { removeWhitePageClass } from '../../../../helpers/pages'; import { - mockComponent, mockCurrentUser, mockEvent, mockIssue, diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AuthorFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AuthorFacet-test.tsx index 336182e6a29..f6e7c64c1df 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AuthorFacet-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AuthorFacet-test.tsx @@ -21,7 +21,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import ListStyleFacet from '../../../../components/facet/ListStyleFacet'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { Query } from '../../utils'; import AuthorFacet from '../AuthorFacet'; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx index a03b532f38f..2dfa5ea4b7d 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { InjectedIntlProps } from 'react-intl'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { ComponentQualifier } from '../../../../types/component'; import { CreationDateFacet } from '../CreationDateFacet'; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/DirectoryFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/DirectoryFacet-test.tsx index 7107e132497..c02ffe434bb 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/DirectoryFacet-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/DirectoryFacet-test.tsx @@ -22,7 +22,7 @@ import * as React from 'react'; import { getDirectories } from '../../../../api/components'; import ListStyleFacet from '../../../../components/facet/ListStyleFacet'; import { mockBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { TreeComponentWithPath } from '../../../../types/component'; import { Query } from '../../utils'; import DirectoryFacet from '../DirectoryFacet'; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx index 2b5d1a3ec25..05f6cde0a30 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx @@ -22,7 +22,7 @@ import * as React from 'react'; import { getFiles } from '../../../../api/components'; import ListStyleFacet from '../../../../components/facet/ListStyleFacet'; import { mockBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { TreeComponentWithPath } from '../../../../types/component'; import { Query } from '../../utils'; import FileFacet from '../FileFacet'; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ProjectFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ProjectFacet-test.tsx index 1a65023a7ea..3c62ca93cb4 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ProjectFacet-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ProjectFacet-test.tsx @@ -21,7 +21,7 @@ import { shallow } from 'enzyme'; import { keyBy } from 'lodash'; import * as React from 'react'; import { getTree, searchProjects } from '../../../../api/components'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { ComponentQualifier } from '../../../../types/component'; import { ReferencedComponent } from '../../../../types/issues'; import { Query } from '../../utils'; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-test.tsx index 3a390895800..996531eda83 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-test.tsx @@ -20,7 +20,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; import { flatten } from 'lodash'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { getGlobalSettingValue } from '../../../../store/rootReducer'; import { ComponentQualifier } from '../../../../types/component'; import { Query } from '../../utils'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-test.tsx index a3c48202045..ee1ba58f1cf 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-test.tsx @@ -22,10 +22,10 @@ import * as React from 'react'; import GraphsHistory from '../../../../components/activity-graph/GraphsHistory'; import { parseDate } from '../../../../helpers/dates'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { mockAnalysis, mockAnalysisEvent, - mockComponent, mockMeasure, mockMetric } from '../../../../helpers/testMocks'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx index aa390cbc15f..08ef85049dd 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx @@ -31,7 +31,8 @@ import { getAllTimeMachineData } from '../../../../api/time-machine'; import { getActivityGraph, saveActivityGraph } from '../../../../components/activity-graph/utils'; import { isDiffMetric } from '../../../../helpers/measures'; import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockAnalysis, mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockAnalysis } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey } from '../../../../types/metrics'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverviewRenderer-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverviewRenderer-test.tsx index 1f0b71a5617..6cc999465a2 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverviewRenderer-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverviewRenderer-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockMeasureEnhanced } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockMeasureEnhanced } from '../../../../helpers/testMocks'; import { GraphType } from '../../../../types/project-activity'; import { BranchOverviewRenderer, BranchOverviewRendererProps } from '../BranchOverviewRenderer'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DebtValue-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DebtValue-test.tsx index bc37b4b153c..c26cec8d1b1 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DebtValue-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DebtValue-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; import { MetricKey } from '../../../../types/metrics'; import { DebtValue, DebtValueProps } from '../DebtValue'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DrilldownMeasureValue-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DrilldownMeasureValue-test.tsx index 03fc869e0e1..dc2c33482b8 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DrilldownMeasureValue-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DrilldownMeasureValue-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; import { MetricKey } from '../../../../types/metrics'; import { DrilldownMeasureValue, DrilldownMeasureValueProps } from '../DrilldownMeasureValue'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx index b7a1c2a1cb1..25df08b9b2c 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx @@ -21,7 +21,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockProjectAlmBindingResponse } from '../../../../helpers/mocks/alm-settings'; -import { mockComponent, mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { FirstAnalysisNextStepsNotif, diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx index de04ea274c8..d7465778f0e 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx @@ -21,12 +21,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import BoxedTabs from '../../../../components/controls/BoxedTabs'; import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { - mockComponent, - mockMeasureEnhanced, - mockMetric, - mockPeriod -} from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockMeasureEnhanced, mockMetric, mockPeriod } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey } from '../../../../types/metrics'; import { MeasuresPanel, MeasuresPanelProps, MeasuresPanelTabs } from '../MeasuresPanel'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx index 91a928f04a0..c9cf2823cd2 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { IssueType } from '../../../../types/issues'; import { MetricKey } from '../../../../types/metrics'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx index d9a85595072..33e67f48fdb 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockPeriod } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockPeriod } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import MeasuresPanelNoNewCode, { MeasuresPanelNoNewCodeProps } from '../MeasuresPanelNoNewCode'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/NoCodeWarning-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/NoCodeWarning-test.tsx index e0baa26de83..8974dda8531 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/NoCodeWarning-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/NoCodeWarning-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey } from '../../../../types/metrics'; import { NoCodeWarning } from '../NoCodeWarning'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanel-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanel-test.tsx index c97b882a732..414d52a8570 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanel-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanel-test.tsx @@ -19,11 +19,12 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { mockQualityGateStatus, mockQualityGateStatusConditionEnhanced } from '../../../../helpers/mocks/quality-gates'; -import { mockComponent, mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; +import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey } from '../../../../types/metrics'; import { QualityGatePanel, QualityGatePanelProps } from '../QualityGatePanel'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx index 254ec8251f0..d368af3864c 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx @@ -20,11 +20,11 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { mockQualityGateStatus, mockQualityGateStatusConditionEnhanced } from '../../../../helpers/mocks/quality-gates'; -import { mockComponent } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey } from '../../../../types/metrics'; import { QualityGatePanelSection, QualityGatePanelSectionProps } from '../QualityGatePanelSection'; diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx index 932418ec3e8..18e1b668e96 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx @@ -21,7 +21,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockProjectGithubBindingResponse } from '../../../../helpers/mocks/alm-settings'; import { mockBranch, mockMainBranch, mockPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { EmptyOverview, EmptyOverviewProps } from '../EmptyOverview'; diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueLabel-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueLabel-test.tsx index 70ba3747edc..eafdb5951b9 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueLabel-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueLabel-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; import { IssueType } from '../../../../types/issues'; import { MetricKey } from '../../../../types/metrics'; import { IssueLabel, IssueLabelProps } from '../IssueLabel'; diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueRating-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueRating-test.tsx index 19608d71b45..49f97db6c15 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueRating-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueRating-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; import { IssueType } from '../../../../types/issues'; import { MetricKey } from '../../../../types/metrics'; import { IssueRating, IssueRatingProps } from '../IssueRating'; diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/MeasurementLabel-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/MeasurementLabel-test.tsx index ea34815b65f..26ef3e2b8af 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/MeasurementLabel-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/MeasurementLabel-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; import { MetricKey } from '../../../../types/metrics'; import { MeasurementType } from '../../utils'; import MeasurementLabel from '../MeasurementLabel'; diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateConditions-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateConditions-test.tsx index 085fd38ac87..b6f760221b6 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateConditions-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateConditions-test.tsx @@ -19,8 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { mockQualityGateStatusConditionEnhanced } from '../../../../helpers/mocks/quality-gates'; -import { mockComponent } from '../../../../helpers/testMocks'; import { click } from '../../../../helpers/testUtils'; import { QualityGateStatusConditionEnhanced } from '../../../../types/quality-gates'; import { QualityGateConditions, QualityGateConditionsProps } from '../QualityGateConditions'; diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/LargeQualityGateBadge-test.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/LargeQualityGateBadge-test.tsx index 6e140cfdc51..89bea9d0427 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/LargeQualityGateBadge-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/LargeQualityGateBadge-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { LargeQualityGateBadge } from '../LargeQualityGateBadge'; it('should render correctly for SQ', () => { diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-test.tsx index 24983be18c3..ee3c9c37e6c 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-test.tsx @@ -21,8 +21,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { getMeasuresWithMetrics } from '../../../../api/measures'; import { mockPullRequest } from '../../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { mockQualityGateStatusCondition } from '../../../../helpers/mocks/quality-gates'; -import { mockComponent } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import { PR_METRICS } from '../../utils'; import { PullRequestOverview } from '../PullRequestOverview'; diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/App-test.tsx index bdb76b8563b..a67d93731e7 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/App-test.tsx +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/App-test.tsx @@ -25,7 +25,7 @@ import { revokePermissionFromGroup, revokePermissionFromUser } from '../../../../../api/permissions'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { waitAndUpdate } from '../../../../../helpers/testUtils'; import App from '../App'; diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx index 3ff3dbc56cc..e7b4a98f350 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx @@ -22,8 +22,8 @@ import * as React from 'react'; import { getChildren } from '../../../../api/components'; import { getMeasures } from '../../../../api/measures'; import handleRequiredAuthentication from '../../../../helpers/handleRequiredAuthentication'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { - mockComponent, mockCurrentUser, mockLocation, mockLoggedInUser, diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/UnsubscribeEmailModal-test.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/UnsubscribeEmailModal-test.tsx index 42c4323cb34..69eff1032a9 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/UnsubscribeEmailModal-test.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/UnsubscribeEmailModal-test.tsx @@ -22,7 +22,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; import * as React from 'react'; import { unsubscribeFromEmailReport } from '../../../../api/component-report'; import SimpleModal from '../../../../components/controls/SimpleModal'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import { ComponentQualifier } from '../../../../types/component'; import UnsubscribeEmailModal from '../UnsubscribeEmailModal'; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppContainer-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppContainer-test.tsx index 6d411fb036c..4483ff095fe 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppContainer-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppContainer-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent, mockLocation, mockMetric, mockRouter } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLocation, mockMetric, mockRouter } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey } from '../../../../types/metrics'; import ProjectActivityAppContainer from '../ProjectActivityAppContainer'; diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/App-test.tsx index ec099bba891..ec22b02053c 100644 --- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/App-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/App-test.tsx @@ -25,7 +25,8 @@ import { setNewCodePeriod } from '../../../../api/newCodePeriod'; import { mockBranch, mockMainBranch, mockPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent, mockEvent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockEvent } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import App from '../App'; diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchList-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchList-test.tsx index 5895a95cfc5..c7d2bdc5682 100644 --- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchList-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchList-test.tsx @@ -21,7 +21,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { listBranchesNewCodePeriod, resetNewCodePeriod } from '../../../../api/newCodePeriod'; import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import BranchBaselineSettingModal from '../BranchBaselineSettingModal'; import BranchList from '../BranchList'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx index 9efd4e124c4..433723127cb 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockSetOfBranchAndPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { App, AppProps } from '../App'; import BranchLikeTabs from '../BranchLikeTabs'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeRow-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeRow-test.tsx index 82bd7a66551..2424ee4dcbb 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeRow-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeRow-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockBranch, mockMainBranch, mockPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { BranchLikeRow, BranchLikeRowProps } from '../BranchLikeRow'; it('should render correctly for pull request', () => { diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTable-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTable-test.tsx index 82a16ccb436..d5697324e24 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTable-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTable-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockSetOfBranchAndPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { BranchLikeRow } from '../BranchLikeRow'; import { BranchLikeTable, BranchLikeTableProps } from '../BranchLikeTable'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTabs-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTabs-test.tsx index f74dbaf81dd..2e65c09d39b 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTabs-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTabs-test.tsx @@ -25,7 +25,7 @@ import { mockPullRequest, mockSetOfBranchAndPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { BranchLikeTable } from '../BranchLikeTable'; import BranchLikeTabs, { Tabs } from '../BranchLikeTabs'; import DeleteBranchModal from '../DeleteBranchModal'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchPurgeSetting-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchPurgeSetting-test.tsx index 19ff713f9eb..2868c5a2362 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchPurgeSetting-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchPurgeSetting-test.tsx @@ -22,7 +22,7 @@ import * as React from 'react'; import { excludeBranchFromPurge } from '../../../../api/branches'; import Toggle from '../../../../components/controls/Toggle'; import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import BranchPurgeSetting from '../BranchPurgeSetting'; jest.mock('../../../../api/branches', () => ({ diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx index 18845abf99a..1c7622b5bb2 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx @@ -21,7 +21,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; import * as React from 'react'; import { deleteBranch, deletePullRequest } from '../../../../api/branches'; import { mockBranch, mockPullRequest } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { click, doAsync, submit, waitAndUpdate } from '../../../../helpers/testUtils'; import { BranchLike } from '../../../../types/branch-like'; import DeleteBranchModal from '../DeleteBranchModal'; diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx index ef7ff7fc0fe..eaba521515d 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/RenameBranchModal-test.tsx @@ -21,7 +21,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; import * as React from 'react'; import { renameBranch } from '../../../../api/branches'; import { mockMainBranch } from '../../../../helpers/mocks/branch-like'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { change, click, doAsync, submit, waitAndUpdate } from '../../../../helpers/testUtils'; import RenameBranchModal from '../RenameBranchModal'; diff --git a/server/sonar-web/src/main/js/apps/projectKey/__tests__/UpdateForm-test.tsx b/server/sonar-web/src/main/js/apps/projectKey/__tests__/UpdateForm-test.tsx index 1f441e68139..f2e4fdb5123 100644 --- a/server/sonar-web/src/main/js/apps/projectKey/__tests__/UpdateForm-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectKey/__tests__/UpdateForm-test.tsx @@ -21,7 +21,8 @@ import { shallow, ShallowWrapper } from 'enzyme'; import * as React from 'react'; import ProjectKeyInput from '../../../components/common/ProjectKeyInput'; import { Button, SubmitButton } from '../../../components/controls/buttons'; -import { mockComponent, mockEvent } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; +import { mockEvent } from '../../../helpers/testMocks'; import { click } from '../../../helpers/testUtils'; import UpdateForm, { UpdateFormProps } from '../UpdateForm'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-test.tsx index 184545784f7..7d3b7248ea4 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-test.tsx @@ -27,8 +27,8 @@ import { searchProjects } from '../../../api/quality-gates'; import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization'; +import { mockComponent } from '../../../helpers/mocks/component'; import { mockQualityGate } from '../../../helpers/mocks/quality-gates'; -import { mockComponent } from '../../../helpers/testMocks'; import { waitAndUpdate } from '../../../helpers/testUtils'; import { USE_SYSTEM_DEFAULT } from '../constants'; import ProjectQualityGateApp from '../ProjectQualityGateApp'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesApp-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesApp-test.tsx index f61d1cb964d..5b0bc461f05 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesApp-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesApp-test.tsx @@ -27,7 +27,7 @@ import { searchQualityProfiles } from '../../../api/quality-profiles'; import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization'; -import { mockComponent } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; import { waitAndUpdate } from '../../../helpers/testUtils'; import ProjectQualityProfilesApp from '../ProjectQualityProfilesApp'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesAppRenderer-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesAppRenderer-test.tsx index 5bd12a25143..abc7ce30519 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesAppRenderer-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesAppRenderer-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent, mockQualityProfile } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; +import { mockQualityProfile } from '../../../helpers/testMocks'; import ProjectQualityProfilesAppRenderer, { ProjectQualityProfilesAppRendererProps } from '../ProjectQualityProfilesAppRenderer'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/SetQualityProfileModal-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/SetQualityProfileModal-test.tsx index 309426a0391..26a5b40fa88 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/SetQualityProfileModal-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/SetQualityProfileModal-test.tsx @@ -22,7 +22,8 @@ import * as React from 'react'; import Radio from '../../../../components/controls/Radio'; import Select from '../../../../components/controls/Select'; import SimpleModal from '../../../../components/controls/SimpleModal'; -import { mockComponent, mockQualityProfile } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockQualityProfile } from '../../../../helpers/testMocks'; import SetQualityProfileModal, { SetQualityProfileModalProps } from '../SetQualityProfileModal'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts index e8e6d37eadf..567a9c322fa 100644 --- a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts +++ b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { searchProjects } from '../../../api/components'; -import { mockComponent } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; import * as utils from '../utils'; jest.mock('../../../api/components', () => ({ diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx index c712a77dac2..5389d134014 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx @@ -22,10 +22,10 @@ import * as React from 'react'; import { getMeasures } from '../../../api/measures'; import { getSecurityHotspotList, getSecurityHotspots } from '../../../api/security-hotspots'; import { mockBranch, mockPullRequest } from '../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../helpers/mocks/component'; import { mockRawHotspot, mockStandards } from '../../../helpers/mocks/security-hotspots'; import { getStandards } from '../../../helpers/security-standard'; import { - mockComponent, mockCurrentUser, mockLocation, mockLoggedInUser, diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx index a716fc2a28f..49d32e3817c 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx @@ -20,9 +20,9 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; +import { mockComponent } from '../../../helpers/mocks/component'; import { mockRawHotspot, mockStandards } from '../../../helpers/mocks/security-hotspots'; import { scrollToElement } from '../../../helpers/scrolling'; -import { mockComponent } from '../../../helpers/testMocks'; import { SecurityStandard } from '../../../types/security'; import { HotspotStatusFilter } from '../../../types/security-hotspots'; import FilterBar from '../components/FilterBar'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx index 875dacc04ba..5f920cd0178 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx @@ -21,7 +21,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import RadioToggle from '../../../../components/controls/RadioToggle'; import Select from '../../../../components/controls/Select'; -import { mockComponent, mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { ComponentQualifier } from '../../../../types/component'; import { HotspotStatusFilter } from '../../../../types/security-hotspots'; import { AssigneeFilterOption, FilterBar, FilterBarProps } from '../FilterBar'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx index b2eb7cae32b..639e39d94e3 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx @@ -22,8 +22,9 @@ import { range } from 'lodash'; import * as React from 'react'; import { getSources } from '../../../../api/components'; import { mockBranch } from '../../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { mockHotspot, mockHotspotComponent } from '../../../../helpers/mocks/security-hotspots'; -import { mockComponent, mockSourceLine } from '../../../../helpers/testMocks'; +import { mockSourceLine } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import { ComponentQualifier } from '../../../../types/component'; import HotspotSnippetContainer from '../HotspotSnippetContainer'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewer-test.tsx index f129626f4ee..022472ae760 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewer-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewer-test.tsx @@ -21,8 +21,8 @@ import { shallow } from 'enzyme'; import { clone } from 'lodash'; import * as React from 'react'; import { getSecurityHotspotDetails } from '../../../../api/security-hotspots'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { scrollToElement } from '../../../../helpers/scrolling'; -import { mockComponent } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import HotspotViewer from '../HotspotViewer'; import HotspotViewerRenderer from '../HotspotViewerRenderer'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerRenderer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerRenderer-test.tsx index d9ae47144ac..24d1ec995bf 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerRenderer-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerRenderer-test.tsx @@ -20,8 +20,9 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockBranch } from '../../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { mockHotspot } from '../../../../helpers/mocks/security-hotspots'; -import { mockComponent, mockCurrentUser, mockUser } from '../../../../helpers/testMocks'; +import { mockCurrentUser, mockUser } from '../../../../helpers/testMocks'; import { HotspotViewerRenderer, HotspotViewerRendererProps } from '../HotspotViewerRenderer'; jest.mock('../../../../helpers/users', () => ({ isLoggedIn: jest.fn(() => true) })); diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AdditionalCategories-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AdditionalCategories-test.tsx index f6ba62847f3..4cfacba64a4 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AdditionalCategories-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AdditionalCategories-test.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { find } from 'lodash'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { ADDITIONAL_CATEGORIES } from '../AdditionalCategories'; import { PULL_REQUEST_DECORATION_BINDING_CATEGORY } from '../AdditionalCategoryKeys'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AllCategoriesList-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AllCategoriesList-test.tsx index 9ca27da9dbe..88919ebb06e 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AllCategoriesList-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AllCategoriesList-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { AdditionalCategory } from '../AdditionalCategories'; import { CategoriesList, CategoriesListProps } from '../AllCategoriesList'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AnalysisScope-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AnalysisScope-test.tsx index 03bf9a98134..90d894e0316 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AnalysisScope-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AnalysisScope-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { AnalysisScope } from '../AnalysisScope'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/Languages-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/Languages-test.tsx index 10da93d2941..09fde507c1f 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/Languages-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/Languages-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import Select from '../../../../components/controls/Select'; -import { mockComponent, mockLocation, mockRouter } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLocation, mockRouter } from '../../../../helpers/testMocks'; import CategoryDefinitionsList from '../CategoryDefinitionsList'; import { Languages, LanguagesProps } from '../Languages'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/PageHeader-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/PageHeader-test.tsx index dad6b6788dc..5c328e880ae 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/PageHeader-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/PageHeader-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import PageHeader, { PageHeaderProps } from '../PageHeader'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx index db848429969..7f6f49e2693 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx @@ -35,7 +35,8 @@ import { mockProjectAlmBindingConfigurationErrors, mockProjectAlmBindingResponse } from '../../../../../helpers/mocks/alm-settings'; -import { mockComponent, mockCurrentUser } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; +import { mockCurrentUser } from '../../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../../helpers/testUtils'; import { AlmKeys, AlmSettingsInstance } from '../../../../../types/alm-settings'; import { PRDecorationBinding } from '../PRDecorationBinding'; diff --git a/server/sonar-web/src/main/js/apps/tutorials/components/__tests__/TutorialsApp-test.tsx b/server/sonar-web/src/main/js/apps/tutorials/components/__tests__/TutorialsApp-test.tsx index db9050fde0f..39c7745f313 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/components/__tests__/TutorialsApp-test.tsx +++ b/server/sonar-web/src/main/js/apps/tutorials/components/__tests__/TutorialsApp-test.tsx @@ -21,7 +21,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import handleRequiredAuthentication from '../../../../helpers/handleRequiredAuthentication'; import { mockProjectAzureBindingResponse } from '../../../../helpers/mocks/alm-settings'; -import { mockComponent, mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { TutorialsApp, TutorialsAppProps } from '../TutorialsApp'; jest.mock('../../../../helpers/handleRequiredAuthentication', () => ({ diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActions-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActions-test.tsx index d686202ef12..748f5e649be 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActions-test.tsx +++ b/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActions-test.tsx @@ -27,8 +27,9 @@ import { } from '../../../api/component-report'; import addGlobalSuccessMessage from '../../../app/utils/addGlobalSuccessMessage'; import { mockBranch } from '../../../helpers/mocks/branch-like'; +import { mockComponent } from '../../../helpers/mocks/component'; import { mockComponentReportStatus } from '../../../helpers/mocks/component-report'; -import { mockComponent, mockCurrentUser } from '../../../helpers/testMocks'; +import { mockCurrentUser } from '../../../helpers/testMocks'; import { waitAndUpdate } from '../../../helpers/testUtils'; import { ComponentQualifier } from '../../../types/component'; import { ComponentReportActions } from '../ComponentReportActions'; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActionsRenderer-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActionsRenderer-test.tsx index 76144927f72..2d0f586ae14 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActionsRenderer-test.tsx +++ b/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActionsRenderer-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; import { ComponentQualifier } from '../../../types/component'; import ComponentReportActionsRenderer, { ComponentReportActionsRendererProps diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx index db142bb8684..22d907817b9 100644 --- a/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx +++ b/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx @@ -19,7 +19,7 @@ */ import { mount, shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; import { KEYCODE_MAP, keydown } from '../../../helpers/testUtils'; import withKeyboardNavigation, { WithKeyboardNavigationProps } from '../withKeyboardNavigation'; diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/actions-test.ts b/server/sonar-web/src/main/js/components/issue/__tests__/actions-test.ts index e62cf86594d..371fd2c35fd 100644 --- a/server/sonar-web/src/main/js/components/issue/__tests__/actions-test.ts +++ b/server/sonar-web/src/main/js/components/issue/__tests__/actions-test.ts @@ -19,7 +19,8 @@ */ import throwGlobalError from '../../../app/utils/throwGlobalError'; import { parseIssueFromResponse } from '../../../helpers/issues'; -import { mockComponent, mockIssue } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; +import { mockIssue } from '../../../helpers/testMocks'; import { updateIssue } from '../actions'; jest.mock('../../../app/utils/throwGlobalError', () => ({ diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-test.tsx b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-test.tsx index db0f2d3055e..c689a64c425 100644 --- a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-test.tsx @@ -25,12 +25,8 @@ import { mockAlmSettingsInstance, mockProjectBitbucketBindingResponse } from '../../../helpers/mocks/alm-settings'; -import { - mockComponent, - mockLocation, - mockLoggedInUser, - mockRouter -} from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; +import { mockLocation, mockLoggedInUser, mockRouter } from '../../../helpers/testMocks'; import { waitAndUpdate } from '../../../helpers/testUtils'; import { getHostUrl } from '../../../helpers/urls'; import { SettingsKey } from '../../../types/settings'; diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelectionRenderer-test.tsx b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelectionRenderer-test.tsx index 35d284ecb0b..ac42189cb50 100644 --- a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelectionRenderer-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelectionRenderer-test.tsx @@ -27,7 +27,8 @@ import { mockProjectGithubBindingResponse, mockProjectGitLabBindingResponse } from '../../../helpers/mocks/alm-settings'; -import { mockComponent, mockLoggedInUser } from '../../../helpers/testMocks'; +import { mockComponent } from '../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../helpers/testMocks'; import { click } from '../../../helpers/testUtils'; import TutorialSelectionRenderer, { TutorialSelectionRendererProps diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/AzurePipelinesTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/AzurePipelinesTutorial-test.tsx index 9109d04627e..13920ae9aa8 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/AzurePipelinesTutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/AzurePipelinesTutorial-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { Button } from '../../../../components/controls/buttons'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import { click } from '../../../../helpers/testUtils'; import Step from '../../components/Step'; import AzurePipelinesTutorial, { AzurePipelinesTutorialProps } from '../AzurePipelinesTutorial'; diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/BranchAnalysisStepContent-test.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/BranchAnalysisStepContent-test.tsx index ac649569b3b..ec6e62e05cc 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/BranchAnalysisStepContent-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/BranchAnalysisStepContent-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import RenderOptions from '../../components/RenderOptions'; import { BuildTools } from '../../types'; import { BranchAnalysisStepContent, BranchesAnalysisStepProps } from '../BranchAnalysisStepContent'; diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/ServiceEndpointStepContent-test.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/ServiceEndpointStepContent-test.tsx index 513b9a5a0af..ebcc8d052ba 100644 --- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/ServiceEndpointStepContent-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/ServiceEndpointStepContent-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { Button } from '../../../../components/controls/buttons'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import { click } from '../../../../helpers/testUtils'; import EditTokenModal from '../../components/EditTokenModal'; import ServiceEndpointStepContent from '../ServiceEndpointStepContent'; diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx index ff047ac097e..a2c296bb55d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockAppState, mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockAppState } from '../../../../helpers/testMocks'; import { BuildTools } from '../../types'; import { AnalysisCommand, AnalysisCommandProps } from '../AnalysisCommand'; diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx index 8d070b65f31..3878f5e5fb8 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx @@ -23,7 +23,8 @@ import { mockAlmSettingsInstance, mockProjectBitbucketCloudBindingResponse } from '../../../../helpers/mocks/alm-settings'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import Step from '../../components/Step'; import { renderStepContent } from '../../test-utils'; import BitbucketPipelinesTutorial, { diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx index bf5057ade16..cf0a479f003 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { BuildTools } from '../../types'; import { PreambuleYaml, PreambuleYamlProps } from '../PreambuleYaml'; diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx index 14413ebaf8c..2a9f717818e 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx @@ -23,7 +23,8 @@ import { mockAlmSettingsInstance, mockProjectBitbucketCloudBindingResponse } from '../../../../helpers/mocks/alm-settings'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import RepositoryVariables, { RepositoryVariablesProps } from '../RepositoryVariables'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/DefaultProjectKey-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/DefaultProjectKey-test.tsx index e4e023f0bd5..1e45b74e0e3 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/DefaultProjectKey-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/DefaultProjectKey-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import DefaultProjectKey, { DefaultProjectKeyProps } from '../DefaultProjectKey'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/EditTokenModal-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/EditTokenModal-test.tsx index 685792f114b..ce9a84bb158 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/EditTokenModal-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/EditTokenModal-test.tsx @@ -20,7 +20,8 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { generateToken, getTokens, revokeToken } from '../../../../api/user-tokens'; -import { mockComponent, mockEvent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockEvent, mockLoggedInUser } from '../../../../helpers/testMocks'; import { waitAndUpdate } from '../../../../helpers/testUtils'; import { getUniqueTokenName } from '../../utils'; import EditTokenModal from '../EditTokenModal'; diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/TokenStepGenerator-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/TokenStepGenerator-test.tsx index b93f00bcdb2..83b9723ee00 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/TokenStepGenerator-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/TokenStepGenerator-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import TokenStepGenerator, { TokenStepGeneratorProps } from '../TokenStepGenerator'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/AnalysisCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/AnalysisCommand-test.tsx index 1013f5cee21..358ed777432 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/AnalysisCommand-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/AnalysisCommand-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockAppState, mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockAppState } from '../../../../helpers/testMocks'; import { BuildTools } from '../../types'; import { AnalysisCommand, AnalysisCommandProps } from '../AnalysisCommand'; diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx index e656347bebc..a63775ce5a9 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx @@ -23,7 +23,8 @@ import { mockAlmSettingsInstance, mockProjectGithubBindingResponse } from '../../../../helpers/mocks/alm-settings'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import Step from '../../components/Step'; import { renderStepContent } from '../../test-utils'; import GitHubActionTutorial, { GitHubActionTutorialProps } from '../GitHubActionTutorial'; diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/SecretStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/SecretStep-test.tsx index 767bbe85691..b9ea1d32daf 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/SecretStep-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/SecretStep-test.tsx @@ -23,7 +23,8 @@ import { mockAlmSettingsInstance, mockProjectGithubBindingResponse } from '../../../../helpers/mocks/alm-settings'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import SecretStep, { SecretStepProps } from '../SecretStep'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx index f851057286e..e56e71f09f2 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import RenderOptions from '../../../components/RenderOptions'; import { OSs } from '../../../types'; import CFamily, { CFamilyProps } from '../CFamily'; diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/DotNet-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/DotNet-test.tsx index c44d6ee550f..cb9810d0f9f 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/DotNet-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/DotNet-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import DotNet, { DotNetProps } from '../DotNet'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/Gradle-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/Gradle-test.tsx index 50431d5dc81..ff73dc765f8 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/Gradle-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/Gradle-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import Gradle, { GradleProps } from '../Gradle'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/JavaMaven-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/JavaMaven-test.tsx index 6b0aecdff16..c62f7064b73 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/JavaMaven-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/JavaMaven-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import JavaMaven, { JavaMavenProps } from '../../commands/JavaMaven'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/Others-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/Others-test.tsx index cb799f321c1..5dfeec6689f 100644 --- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/Others-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/Others-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import Others, { OthersProps } from '../../commands/Others'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/EnvironmentVariablesStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/EnvironmentVariablesStep-test.tsx index 8d2b3419819..7b146953c3d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/EnvironmentVariablesStep-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/EnvironmentVariablesStep-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import { renderStepContent } from '../../test-utils'; import EnvironmentVariablesStep, { EnvironmentVariablesStepProps diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/GitLabCITutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/GitLabCITutorial-test.tsx index d0bfca74d28..82e611e5942 100644 --- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/GitLabCITutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/GitLabCITutorial-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import GitLabCITutorial, { GitLabCITutorialProps } from '../GitLabCITutorial'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/ProjectKeyStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/ProjectKeyStep-test.tsx index 418bbbfd0ad..ad2e8305094 100644 --- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/ProjectKeyStep-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/ProjectKeyStep-test.tsx @@ -19,7 +19,7 @@ */ import { shallow, ShallowWrapper } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import RenderOptions from '../../components/RenderOptions'; import { renderStepContent } from '../../test-utils'; import { BuildTools } from '../../types'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx index 9e48708164f..411c655925d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockProjectBitbucketBindingResponse } from '../../../../helpers/mocks/alm-settings'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import { AlmKeys } from '../../../../types/alm-settings'; import JenkinsfileStep from '../JenkinsfileStep'; import { JenkinsTutorial, JenkinsTutorialProps } from '../JenkinsTutorial'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx index 8238457e619..d2f266fec5a 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx @@ -19,7 +19,7 @@ */ import { shallow, ShallowWrapper } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import RenderOptions from '../../components/RenderOptions'; import Step from '../../components/Step'; import { renderStepContent } from '../../test-utils'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CFamilly-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CFamilly-test.tsx index 850cc51fb31..0d93ba43553 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CFamilly-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CFamilly-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import RenderOptions from '../../../components/RenderOptions'; import { OSs } from '../../../types'; import { LanguageProps } from '../../JenkinsfileStep'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNet-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNet-test.tsx index 34fb7885039..d8dc2c966db 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNet-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNet-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { LanguageProps } from '../../JenkinsfileStep'; import DotNet from '../DotNet'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx index 7656b8e39b4..a63873307d9 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetCore-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { OSs } from '../../../types'; import { DotNetCoreFrameworkProps } from '../DotNet'; import DotNetCore from '../DotNetCore'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx index 44837fe60cf..3f9ac6dafdb 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/DotNetFramework-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { OSs } from '../../../types'; import { DotNetCoreFrameworkProps } from '../DotNet'; import DotNetFramework from '../DotNetFramework'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Gradle-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Gradle-test.tsx index 6f3821676f0..8f10483cd08 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Gradle-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Gradle-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { LanguageProps } from '../../JenkinsfileStep'; import Gradle from '../Gradle'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Maven-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Maven-test.tsx index 4eb619ffd64..14be36e2bc0 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Maven-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Maven-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { LanguageProps } from '../../JenkinsfileStep'; import Maven from '../Maven'; diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Other-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Other-test.tsx index 0916d828d7a..0c2d7283f07 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Other-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/Other-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { LanguageProps } from '../../JenkinsfileStep'; import Other from '../Other'; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/DoneNextSteps-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/DoneNextSteps-test.tsx index 9c391389bd5..48fb1894a32 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/DoneNextSteps-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/DoneNextSteps-test.tsx @@ -20,7 +20,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import DoneNextSteps, { DoneNextStepsProps } from '../DoneNextSteps'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ManualTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ManualTutorial-test.tsx index a32b46c3723..ba8d674af19 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ManualTutorial-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ManualTutorial-test.tsx @@ -19,7 +19,8 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; +import { mockLoggedInUser } from '../../../../helpers/testMocks'; import ManualTutorial from '../ManualTutorial'; import ProjectAnalysisStep from '../ProjectAnalysisStep'; import TokenStep from '../TokenStep'; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ProjectAnalysisStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ProjectAnalysisStep-test.tsx index 9075259997b..b2c73d02f7e 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ProjectAnalysisStep-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/__tests__/ProjectAnalysisStep-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../helpers/testMocks'; +import { mockComponent } from '../../../../helpers/mocks/component'; import ProjectAnalysisStep from '../ProjectAnalysisStep'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/AnalysisCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/AnalysisCommand-test.tsx index 55b3f92b160..e618b954e5e 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/AnalysisCommand-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/AnalysisCommand-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { BuildTools, OSs } from '../../../types'; import AnalysisCommand, { AnalysisCommandProps } from '../AnalysisCommand'; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/CLangGCCCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/CLangGCCCommand-test.tsx index 574c5fbb785..7591c2e3607 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/CLangGCCCommand-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/CLangGCCCommand-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { OSs } from '../../../types'; import ClangGCCCommand from '../ClangGCCCommand'; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx index 86e50f914ba..71728f6c9a7 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNet-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import DotNet from '../DotNet'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetExecute-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetExecute-test.tsx index 563cae7b1ab..b96aab57d77 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetExecute-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetExecute-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import DotNetExecute from '../DotNetExecute'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetFramework-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetFramework-test.tsx index e2cfce486d8..c4d850149fd 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetFramework-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotNetFramework-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import DotNetFramework from '../DotNetFramework'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotnetCore-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotnetCore-test.tsx index ecf1c268cee..d6df43d7f87 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotnetCore-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/DotnetCore-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import DotNetCore from '../DotNetCore'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecScanner-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecScanner-test.tsx index 9f9ccd1d23b..07295a31230 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecScanner-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/ExecScanner-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { OSs } from '../../../types'; import ExecScanner, { ExecScannerProps } from '../ExecScanner'; diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx index e9f868da12a..f41b363d7c4 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaGradle-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import JavaGradle from '../JavaGradle'; it('renders correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx index 054fa94df61..be2c5284e99 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/JavaMaven-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import JavaMaven from '../JavaMaven'; it('renders correctly', () => { diff --git a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx index db6f85490ed..accbcf9c6c3 100644 --- a/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/manual/commands/__tests__/Other-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockComponent } from '../../../../../helpers/testMocks'; +import { mockComponent } from '../../../../../helpers/mocks/component'; import { OSs } from '../../../types'; import Other, { OtherProps } from '../Other'; diff --git a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts index bfa2ac6b793..17862dbe6be 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts @@ -20,9 +20,11 @@ import { AlmKeys } from '../../types/alm-settings'; import { ComponentQualifier } from '../../types/component'; import { IssueType } from '../../types/issues'; +import { mockBranch, mockMainBranch, mockPullRequest } from '../mocks/branch-like'; import { convertGithubApiUrlToLink, getComponentDrilldownUrl, + getComponentDrilldownUrlWithSelection, getComponentIssuesUrl, getComponentOverviewUrl, getComponentSecurityHotspotsUrl, @@ -142,6 +144,92 @@ describe('#getComponentDrilldownUrl', () => { }); }); +describe('#getComponentDrilldownUrlWithSelection', () => { + it('should return component drilldown url with selection', () => { + expect( + getComponentDrilldownUrlWithSelection(SIMPLE_COMPONENT_KEY, COMPLEX_COMPONENT_KEY, METRIC) + ).toEqual({ + pathname: '/component_measures', + query: { id: SIMPLE_COMPONENT_KEY, metric: METRIC, selected: COMPLEX_COMPONENT_KEY } + }); + }); + + it('should return component drilldown url with branchLike', () => { + expect( + getComponentDrilldownUrlWithSelection( + SIMPLE_COMPONENT_KEY, + COMPLEX_COMPONENT_KEY, + METRIC, + mockBranch({ name: 'foo' }) + ) + ).toEqual({ + pathname: '/component_measures', + query: { + id: SIMPLE_COMPONENT_KEY, + metric: METRIC, + selected: COMPLEX_COMPONENT_KEY, + branch: 'foo' + } + }); + }); + + it('should return component drilldown url with view parameter', () => { + expect( + getComponentDrilldownUrlWithSelection( + SIMPLE_COMPONENT_KEY, + COMPLEX_COMPONENT_KEY, + METRIC, + undefined, + 'list' + ) + ).toEqual({ + pathname: '/component_measures', + query: { + id: SIMPLE_COMPONENT_KEY, + metric: METRIC, + selected: COMPLEX_COMPONENT_KEY, + view: 'list' + } + }); + + expect( + getComponentDrilldownUrlWithSelection( + SIMPLE_COMPONENT_KEY, + COMPLEX_COMPONENT_KEY, + METRIC, + mockMainBranch(), + 'treemap' + ) + ).toEqual({ + pathname: '/component_measures', + query: { + id: SIMPLE_COMPONENT_KEY, + metric: METRIC, + selected: COMPLEX_COMPONENT_KEY, + view: 'treemap' + } + }); + + expect( + getComponentDrilldownUrlWithSelection( + SIMPLE_COMPONENT_KEY, + COMPLEX_COMPONENT_KEY, + METRIC, + mockPullRequest({ key: '1' }), + 'tree' + ) + ).toEqual({ + pathname: '/component_measures', + query: { + id: SIMPLE_COMPONENT_KEY, + metric: METRIC, + selected: COMPLEX_COMPONENT_KEY, + pullRequest: '1' + } + }); + }); +}); + describe('#getQualityGate(s)Url', () => { it('should work as expected', () => { expect(getQualityGatesUrl()).toEqual({ pathname: '/quality_gates' }); diff --git a/server/sonar-web/src/main/js/helpers/mocks/component.ts b/server/sonar-web/src/main/js/helpers/mocks/component.ts index 4bcbde0cb11..990ad003a5c 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/component.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/component.ts @@ -17,7 +17,52 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { mockComponentMeasure, mockMeasureEnhanced } from '../testMocks'; +import { ComponentQualifier } from '../../types/component'; +import { MetricKey } from '../../types/metrics'; +import { mockMeasureEnhanced } from '../testMocks'; + +export function mockComponent(overrides: Partial<T.Component> = {}): T.Component { + return { + breadcrumbs: [], + key: 'my-project', + name: 'MyProject', + qualifier: ComponentQualifier.Project, + qualityGate: { isDefault: true, key: '30', name: 'Sonar way' }, + qualityProfiles: [ + { + deleted: false, + key: 'my-qp', + language: 'ts', + name: 'Sonar way' + } + ], + tags: [], + ...overrides + }; +} + +export function mockComponentMeasure( + file = false, + overrides: Partial<T.ComponentMeasure> = {} +): T.ComponentMeasure { + if (file) { + return { + key: 'foo:src/index.tsx', + name: 'index.tsx', + qualifier: ComponentQualifier.File, + path: 'src/index.tsx', + measures: [{ metric: MetricKey.bugs, value: '1', bestValue: false }], + ...overrides + }; + } + return { + key: 'foo', + name: 'Foo', + qualifier: ComponentQualifier.Project, + measures: [{ metric: MetricKey.bugs, value: '12', bestValue: false }], + ...overrides + }; +} export function mockComponentMeasureEnhanced( overrides: Partial<T.ComponentMeasureEnhanced> = {} diff --git a/server/sonar-web/src/main/js/helpers/testMocks.ts b/server/sonar-web/src/main/js/helpers/testMocks.ts index d4bdd520184..4a8b891a9cd 100644 --- a/server/sonar-web/src/main/js/helpers/testMocks.ts +++ b/server/sonar-web/src/main/js/helpers/testMocks.ts @@ -23,7 +23,6 @@ import { InjectedRouter } from 'react-router'; import { createStore, Store } from 'redux'; import { DocumentationEntry } from '../apps/documentation/utils'; import { Exporter, Profile } from '../apps/quality-profiles/types'; -import { ComponentQualifier } from '../types/component'; export function mockAlmApplication(overrides: Partial<T.AlmApplication> = {}): T.AlmApplication { return { @@ -256,49 +255,6 @@ export function mockClusterSysInfo(overrides: Partial<any> = {}): T.SysInfoClust }; } -export function mockComponent(overrides: Partial<T.Component> = {}): T.Component { - return { - breadcrumbs: [], - key: 'my-project', - name: 'MyProject', - qualifier: ComponentQualifier.Project, - qualityGate: { isDefault: true, key: '30', name: 'Sonar way' }, - qualityProfiles: [ - { - deleted: false, - key: 'my-qp', - language: 'ts', - name: 'Sonar way' - } - ], - tags: [], - ...overrides - }; -} - -export function mockComponentMeasure( - file = false, - overrides: Partial<T.ComponentMeasure> = {} -): T.ComponentMeasure { - if (file) { - return { - key: 'foo:src/index.tsx', - name: 'index.tsx', - qualifier: 'FIL', - path: 'src/index.tsx', - measures: [{ metric: 'bugs', value: '1', bestValue: false }], - ...overrides - }; - } - return { - key: 'foo', - name: 'Foo', - qualifier: 'TRK', - measures: [{ metric: 'bugs', value: '12', bestValue: false }], - ...overrides - }; -} - export function mockCondition(overrides: Partial<T.Condition> = {}): T.Condition { return { error: '10', diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts index d0a95a62878..879d809e080 100644 --- a/server/sonar-web/src/main/js/helpers/urls.ts +++ b/server/sonar-web/src/main/js/helpers/urls.ts @@ -22,6 +22,7 @@ import { stringify } from 'querystring'; import { getProfilePath } from '../apps/quality-profiles/utils'; import { BranchLike, BranchParameters } from '../types/branch-like'; import { ComponentQualifier, isApplication, isPortfolioLike } from '../types/component'; +import { MeasurePageView } from '../types/measures'; import { GraphType } from '../types/project-activity'; import { SecurityStandard } from '../types/security'; import { getBranchLikeQuery, isBranch, isMainBranch, isPullRequest } from './branch-like'; @@ -172,9 +173,17 @@ export function getComponentDrilldownUrlWithSelection( componentKey: string, selectionKey: string, metric: string, - branchLike?: BranchLike + branchLike?: BranchLike, + view?: MeasurePageView ): Location { - return getComponentDrilldownUrl({ componentKey, selectionKey, metric, branchLike }); + return getComponentDrilldownUrl({ + componentKey, + selectionKey, + metric, + branchLike, + treemapView: view === 'treemap', + listView: view === 'list' + }); } export function getMeasureTreemapUrl(componentKey: string, metric: string) { diff --git a/server/sonar-web/src/main/js/types/component.ts b/server/sonar-web/src/main/js/types/component.ts index 438610f110a..ac13fb4effe 100644 --- a/server/sonar-web/src/main/js/types/component.ts +++ b/server/sonar-web/src/main/js/types/component.ts @@ -73,3 +73,9 @@ export function isApplication( ): componentQualifier is ComponentQualifier.Application { return componentQualifier === ComponentQualifier.Application; } + +export function isProject( + componentQualifier?: string | ComponentQualifier +): componentQualifier is ComponentQualifier.Project { + return componentQualifier === ComponentQualifier.Project; +} diff --git a/server/sonar-web/src/main/js/types/measures.ts b/server/sonar-web/src/main/js/types/measures.ts index f395846890f..cc48756a394 100644 --- a/server/sonar-web/src/main/js/types/measures.ts +++ b/server/sonar-web/src/main/js/types/measures.ts @@ -33,3 +33,5 @@ export interface MeasuresAndMetaWithPeriod { component: T.ComponentMeasure; period: T.Period; } + +export type MeasurePageView = 'list' | 'tree' | 'treemap'; |