]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-22049 Align isPortfolioLike
authorViktor Vorona <viktor.vorona@sonarsource.com>
Fri, 26 Apr 2024 14:53:27 +0000 (16:53 +0200)
committerMatteo Mara <matteo.mara@sonarsource.com>
Tue, 30 Apr 2024 08:59:04 +0000 (10:59 +0200)
27 files changed:
server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx
server/sonar-web/src/main/js/apps/code/components/CodeAppRenderer.tsx
server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx
server/sonar-web/src/main/js/apps/code/components/Search.tsx
server/sonar-web/src/main/js/apps/code/utils.ts
server/sonar-web/src/main/js/apps/component-measures/components/ComponentMeasuresApp.tsx
server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx
server/sonar-web/src/main/js/apps/overview/components/App.tsx
server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx
server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx
server/sonar-web/src/main/js/helpers/urls.ts
server/sonar-web/src/main/js/queries/branch.tsx
server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/__snapshots__/component-test.ts.snap [new file with mode: 0644]
server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/component-test.ts [new file with mode: 0644]
server/sonar-web/src/main/js/sonar-aligned/helpers/component.ts [new file with mode: 0644]
server/sonar-web/src/main/js/types/__tests__/__snapshots__/component-test.ts.snap
server/sonar-web/src/main/js/types/__tests__/component-test.ts
server/sonar-web/src/main/js/types/component.ts

index e05163099abe0cfb8ee82d9ed0bea57b91985fe7..228a263d93bace17f8f8a39d5c29b916b2d38847 100644 (file)
@@ -33,9 +33,10 @@ import { translateWithParameters } from '../../helpers/l10n';
 import { HttpStatus } from '../../helpers/request';
 import { getPortfolioUrl, getProjectUrl, getPullRequestUrl } from '../../helpers/urls';
 import { useBranchesQuery } from '../../queries/branch';
+import { isPortfolioLike } from '../../sonar-aligned/helpers/component';
 import { ProjectAlmBindingConfigurationErrors } from '../../types/alm-settings';
 import { Branch } from '../../types/branch-like';
-import { isFile, isPortfolioLike } from '../../types/component';
+import { isFile } from '../../types/component';
 import { Feature } from '../../types/features';
 import { Task, TaskStatuses, TaskTypes } from '../../types/tasks';
 import { Component } from '../../types/types';
index c36789459d4688b7d086881cc7dc0d51f9579e39..46d1e5da73128ee550e7df184a3b24907163f218 100644 (file)
@@ -35,7 +35,8 @@ import { isPullRequest } from '../../../../helpers/branch-like';
 import { hasMessage, translate, translateWithParameters } from '../../../../helpers/l10n';
 import { getPortfolioUrl, getProjectQueryUrl } from '../../../../helpers/urls';
 import { useBranchesQuery } from '../../../../queries/branch';
-import { isApplication, isPortfolioLike, isProject } from '../../../../types/component';
+import { isPortfolioLike } from '../../../../sonar-aligned/helpers/component';
+import { isApplication, isProject } from '../../../../types/component';
 import { Feature } from '../../../../types/features';
 import { Component, Dict, Extension } from '../../../../types/types';
 import withAvailableFeatures, {
index bff801dbc15bc13a94e7a2a1d25267640725ae6a..00a3ee090e88333b0f1ee49da8f266bd80424743 100644 (file)
@@ -34,7 +34,7 @@ import {
   getProjectUrl,
   getPullRequestUrl,
 } from '../../../helpers/urls';
-import { isPortfolioLike } from '../../../types/component';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { Task } from '../../../types/tasks';
 
 interface Props {
index a598b0920693a3b3a998deaade7a515300e70952..60a76bd2db957e9e537f3c10817961ad94b38fb8 100644 (file)
@@ -25,7 +25,7 @@ import withComponentContext from '../../../app/components/componentContext/withC
 import withMetricsContext from '../../../app/components/metrics/withMetricsContext';
 import { CodeScope, getCodeUrl, getProjectUrl } from '../../../helpers/urls';
 import { WithBranchLikesProps, useBranchesQuery } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../types/component';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { Breadcrumb, Component, ComponentMeasure, Dict, Metric } from '../../../types/types';
 import { addComponent, addComponentBreadcrumbs, clearBucket } from '../bucket';
 import { loadMoreChildren, retrieveComponent, retrieveComponentChildren } from '../utils';
index 7b50ee8b8fbc114eb9715c0cab6eddc01357079a..71f21866ede9bba76ccba5f8e3db9367710162cb 100644 (file)
@@ -39,8 +39,9 @@ import { CCT_SOFTWARE_QUALITY_METRICS, OLD_TAXONOMY_METRICS } from '../../../hel
 import { KeyboardKeys } from '../../../helpers/keycodes';
 import { translate } from '../../../helpers/l10n';
 import { areCCTMeasuresComputed } from '../../../helpers/measures';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { BranchLike } from '../../../types/branch-like';
-import { isApplication, isPortfolioLike } from '../../../types/component';
+import { isApplication } from '../../../types/component';
 import { Breadcrumb, Component, ComponentMeasure, Dict, Metric } from '../../../types/types';
 import { getCodeMetrics } from '../utils';
 import CodeBreadcrumbs from './CodeBreadcrumbs';
index f06edd9d8d927cf6f9dde66bb5a43d6d310b0b96..be00b55a9f11c6b27ebf7d99d73f5a25c6c1e347 100644 (file)
@@ -26,8 +26,9 @@ import { ComponentQualifier } from '~sonar-aligned/types/component';
 import { translate } from '../../../helpers/l10n';
 import { isDefined } from '../../../helpers/types';
 import { CodeScope, getComponentOverviewUrl } from '../../../helpers/urls';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { BranchLike } from '../../../types/branch-like';
-import { isApplication, isPortfolioLike, isProject } from '../../../types/component';
+import { isApplication, isProject } from '../../../types/component';
 import { ComponentMeasure } from '../../../types/types';
 import { mostCommonPrefix } from '../utils';
 
index 7c5f749e51256aa16c98ee96b9f4f810e468f7a4..e50a6a6e8988070dd1fda19c4c5fbb756c181941 100644 (file)
  */
 import { ContentCell, NumericalCell, RatingCell } from 'design-system';
 import * as React from 'react';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
 import { MetricKey } from '~sonar-aligned/types/metrics';
 import {
   CCT_SOFTWARE_QUALITY_METRICS,
   OLD_TO_NEW_TAXONOMY_METRICS_MAP,
 } from '../../../helpers/constants';
 import { translate } from '../../../helpers/l10n';
-import { isPortfolioLike } from '../../../types/component';
 import { ComponentMeasure } from '../../../types/types';
 
 interface ComponentsHeaderProps {
index ce7cb76897d45bf9c8465eccae12d0bcc08b6515..17db6ae55250498d7ffeb639feeb2455fa2903c5 100644 (file)
@@ -28,8 +28,9 @@ import { Location, Router } from '~sonar-aligned/types/router';
 import { getTree } from '../../../api/components';
 import { KeyboardKeys } from '../../../helpers/keycodes';
 import { translate } from '../../../helpers/l10n';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { BranchLike } from '../../../types/branch-like';
-import { isPortfolioLike, isView } from '../../../types/component';
+import { isView } from '../../../types/component';
 import { ComponentMeasure } from '../../../types/types';
 
 interface Props {
index 60a43d3cd4b0d97cdf8af7815f30dcf35619292c..fc0d3d09c22d79d61f07a26d7676ca13395eb863 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
 import { ComponentQualifier } from '~sonar-aligned/types/component';
 import { MetricKey } from '~sonar-aligned/types/metrics';
 import { getBreadcrumbs, getChildren, getComponent, getComponentData } from '../../api/components';
 import { isPullRequest } from '../../helpers/branch-like';
 import { CCT_SOFTWARE_QUALITY_METRICS, OLD_TAXONOMY_METRICS } from '../../helpers/constants';
 import { BranchLike } from '../../types/branch-like';
-import { isPortfolioLike } from '../../types/component';
 import { Breadcrumb, ComponentMeasure } from '../../types/types';
 import {
   addComponent,
index a699e6a12cb26c4e9f5e241686b3f0ade3580e5d..b04b06bcb44148c55eaa0b7740f45586d333d8d8 100644 (file)
@@ -48,7 +48,7 @@ import { isPullRequest, isSameBranchLike } from '../../../helpers/branch-like';
 import { translate } from '../../../helpers/l10n';
 import { areLeakAndOverallCCTMeasuresComputed } from '../../../helpers/measures';
 import { WithBranchLikesProps, useBranchesQuery } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../types/component';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { MeasurePageView } from '../../../types/measures';
 import { ComponentMeasure, Dict, MeasureEnhanced, Metric, Period } from '../../../types/types';
 import Sidebar from '../sidebar/Sidebar';
index bce2730448a105f0bbe7f85f690c81fe7a940583..a6ef20e483b9c4fd819897f95158385dd7a7cedf 100644 (file)
@@ -62,8 +62,9 @@ import { KeyboardKeys } from '../../../helpers/keycodes';
 import { translate, translateWithParameters } from '../../../helpers/l10n';
 import { serializeDate } from '../../../helpers/query';
 import { withBranchLikes } from '../../../queries/branch';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { BranchLike } from '../../../types/branch-like';
-import { isPortfolioLike, isProject } from '../../../types/component';
+import { isProject } from '../../../types/component';
 import {
   ASSIGNEE_ME,
   Facet,
index 182d77c96c2ac9385840160761d933e5eeeadb40..a54aeb4fb1585d3cf004c8c7d34c73edea25046b 100644 (file)
@@ -25,9 +25,10 @@ import { ComponentQualifier } from '~sonar-aligned/types/component';
 import withAppStateContext from '../../../app/components/app-state/withAppStateContext';
 import { isPullRequest } from '../../../helpers/branch-like';
 import { translate } from '../../../helpers/l10n';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { AppState } from '../../../types/appstate';
 import { BranchLike } from '../../../types/branch-like';
-import { isApplication, isPortfolioLike, isProject, isView } from '../../../types/component';
+import { isApplication, isProject, isView } from '../../../types/component';
 import {
   Facet,
   ReferencedComponent,
index 41c4648b96d6ed2a017ea1b1487b121b7ecf1103..2cc345e1ba6ab991f53907399a1caa1fd63e1dd1 100644 (file)
@@ -32,9 +32,9 @@ import AnalysisMissingInfoMessage from '../../../components/shared/AnalysisMissi
 import { parseDate } from '../../../helpers/dates';
 import { areCCTMeasuresComputed, isDiffMetric } from '../../../helpers/measures';
 import { CodeScope } from '../../../helpers/urls';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { ApplicationPeriod } from '../../../types/application';
 import { Branch } from '../../../types/branch-like';
-import { isPortfolioLike } from '../../../types/component';
 import { Analysis, GraphType, MeasureHistory } from '../../../types/project-activity';
 import { QualityGateStatus } from '../../../types/quality-gates';
 import { Component, MeasureEnhanced, Metric, Period, QualityGate } from '../../../types/types';
index 661321fea7a824913040f8cbf95e62027741ef73..4c7a33f930eee6be1a228df3fd91b4bbad38c3ee 100644 (file)
@@ -27,7 +27,7 @@ import Suggestions from '../../../components/embed-docs-modal/Suggestions';
 import { isPullRequest } from '../../../helpers/branch-like';
 import { translate } from '../../../helpers/l10n';
 import { useBranchesQuery } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../types/component';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import { Feature } from '../../../types/features';
 import { Component } from '../../../types/types';
 import BranchOverview from '../branches/BranchOverview';
index 08a16d3767916b0e5306ff1f137be5acdb1e946c..f72eae8e24bae0da309562759be777213c2a7ece 100644 (file)
@@ -25,7 +25,8 @@ import { Image } from '../../../../components/common/Image';
 import { translate } from '../../../../helpers/l10n';
 import { isDefined } from '../../../../helpers/types';
 import { useGithubProvisioningEnabledQuery } from '../../../../queries/identity-provider/github';
-import { isApplication, isPortfolioLike, isProject } from '../../../../types/component';
+import { isPortfolioLike } from '../../../../sonar-aligned/helpers/component';
+import { isApplication, isProject } from '../../../../types/component';
 import { Component } from '../../../../types/types';
 import ApplyTemplate from './ApplyTemplate';
 
index 54097f3488cd77f2de0f4cfc9dd90030a53893d3..dca1b0e056c9a571bf31190fc37c22cde54827df 100644 (file)
@@ -20,6 +20,7 @@
 import React from 'react';
 import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
 import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
 import { MetricKey } from '~sonar-aligned/types/metrics';
 import {
   useComponent,
@@ -37,7 +38,7 @@ import useApplicationLeakQuery from '../../../queries/applications';
 import { useBranchesQuery } from '../../../queries/branch';
 import { useAllMeasuresHistoryQuery } from '../../../queries/measures';
 import { useAllProjectAnalysesQuery } from '../../../queries/project-analyses';
-import { isApplication, isPortfolioLike, isProject } from '../../../types/component';
+import { isApplication, isProject } from '../../../types/component';
 import { MeasureHistory, ParsedAnalysis } from '../../../types/project-activity';
 import { Query, parseQuery, serializeUrlQuery } from '../utils';
 import ProjectActivityAppRenderer from './ProjectActivityAppRenderer';
index eb2348a7dab651246899b69efcd8b2839f1c68f4..b1251e4eddd82606c087937f57443ad9850991b0 100644 (file)
@@ -21,7 +21,7 @@ import { InputSelect, LabelValueSelectOption } from 'design-system';
 import * as React from 'react';
 import { ComponentQualifier } from '~sonar-aligned/types/component';
 import { translate } from '../../../helpers/l10n';
-import { isPortfolioLike } from '../../../types/component';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
 import {
   ApplicationAnalysisEventCategory,
   ProjectAnalysisEventCategory,
index 8da90b6c0dd5ad08765dcffea863ca4d56c6aa94..4ca0bbcb80b6ffac9a4b457cd9ffa085f1e603bd 100644 (file)
@@ -26,7 +26,8 @@ import { deleteApplication } from '../../api/application';
 import { deletePortfolio, deleteProject } from '../../api/project-management';
 import ConfirmButton from '../../components/controls/ConfirmButton';
 import { translate, translateWithParameters } from '../../helpers/l10n';
-import { isApplication, isPortfolioLike } from '../../types/component';
+import { isPortfolioLike } from '../../sonar-aligned/helpers/component';
+import { isApplication } from '../../types/component';
 import { Component } from '../../types/types';
 
 interface Props {
index af08d4c38f3a8bfb0e90551d2a63ebdcbbb12def..44cef2bea20d4d8c770528303a3b50e6c05275c4 100644 (file)
@@ -20,7 +20,8 @@
 import { Title } from 'design-system';
 import * as React from 'react';
 import { translate } from '../../helpers/l10n';
-import { isApplication, isPortfolioLike } from '../../types/component';
+import { isPortfolioLike } from '../../sonar-aligned/helpers/component';
+import { isApplication } from '../../types/component';
 import { Component } from '../../types/types';
 
 interface Props {
index c4fa26967fe7853cb6e9b84d0d6a62f04811eea3..f8855c86d6ba2428b9af7eaf11ecc6ec449ea3e5 100644 (file)
@@ -24,8 +24,9 @@ import { BranchParameters } from '~sonar-aligned/types/branch-like';
 import { ComponentQualifier } from '~sonar-aligned/types/component';
 import { getProfilePath } from '../apps/quality-profiles/utils';
 import { DEFAULT_ISSUES_QUERY } from '../components/shared/utils';
+import { isPortfolioLike } from '../sonar-aligned/helpers/component';
 import { BranchLike } from '../types/branch-like';
-import { isApplication, isPortfolioLike } from '../types/component';
+import { isApplication } from '../types/component';
 import { MeasurePageView } from '../types/measures';
 import { GraphType } from '../types/project-activity';
 import { Dict } from '../types/types';
index 642f58db08f8d290aa39c465a8bca1baaf653e1e..4e0644d48c57cb37bb7a62315e58e07c04e75e46 100644 (file)
@@ -39,8 +39,9 @@ import { getQualityGateProjectStatus } from '../api/quality-gates';
 import { AvailableFeaturesContext } from '../app/components/available-features/AvailableFeaturesContext';
 import { isPullRequest } from '../helpers/branch-like';
 import { extractStatusConditionsFromProjectStatus } from '../helpers/qualityGates';
+import { isPortfolioLike } from '../sonar-aligned/helpers/component';
 import { Branch, BranchLike } from '../types/branch-like';
-import { isApplication, isPortfolioLike, isProject } from '../types/component';
+import { isApplication, isProject } from '../types/component';
 import { Feature } from '../types/features';
 import { Component, LightComponent } from '../types/types';
 
diff --git a/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/__snapshots__/component-test.ts.snap b/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/__snapshots__/component-test.ts.snap
new file mode 100644 (file)
index 0000000..8c0c1bf
--- /dev/null
@@ -0,0 +1,15 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`[Function isPortfolioLike] should work properly 1`] = `
+{
+  "APP": false,
+  "BRC": false,
+  "DEV": false,
+  "DIR": false,
+  "FIL": false,
+  "SVW": true,
+  "TRK": false,
+  "UTS": false,
+  "VW": true,
+}
+`;
diff --git a/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/component-test.ts b/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/component-test.ts
new file mode 100644 (file)
index 0000000..cbc6899
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+import { ComponentQualifier } from '~sonar-aligned/types/component';
+import { isPortfolioLike } from '../component';
+
+it.each([[isPortfolioLike]])(
+  '%p should work properly',
+  (utilityMethod: (componentQualifier: ComponentQualifier) => void) => {
+    const results = Object.values(ComponentQualifier).reduce(
+      (prev, qualifier) => ({ ...prev, [qualifier]: utilityMethod(qualifier) }),
+      {},
+    );
+    expect(results).toMatchSnapshot();
+  },
+);
diff --git a/server/sonar-web/src/main/js/sonar-aligned/helpers/component.ts b/server/sonar-web/src/main/js/sonar-aligned/helpers/component.ts
new file mode 100644 (file)
index 0000000..0be481e
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+import { ComponentQualifier } from '~sonar-aligned/types/component';
+
+export function isPortfolioLike(
+  componentQualifier?: string | ComponentQualifier,
+): componentQualifier is ComponentQualifier.Portfolio | ComponentQualifier.SubPortfolio {
+  return (
+    componentQualifier === ComponentQualifier.Portfolio ||
+    componentQualifier === ComponentQualifier.SubPortfolio
+  );
+}
index 519f2d6f978765325ddbafce320aaabddd682b48..705b12fb87fe47ff59ebcd97c29b4da1b385afb2 100644 (file)
@@ -28,20 +28,6 @@ exports[`[Function isFile] should work properly 1`] = `
 }
 `;
 
-exports[`[Function isPortfolioLike] should work properly 1`] = `
-{
-  "APP": false,
-  "BRC": false,
-  "DEV": false,
-  "DIR": false,
-  "FIL": false,
-  "SVW": true,
-  "TRK": false,
-  "UTS": false,
-  "VW": true,
-}
-`;
-
 exports[`[Function isProject] should work properly 1`] = `
 {
   "APP": false,
index f024bff9c146688cc79188aad10a39d52a803b42..1a2d237f6dedba0de8a9df10eb32c70c424dade6 100644 (file)
@@ -18,9 +18,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import { ComponentQualifier } from '~sonar-aligned/types/component';
-import { isApplication, isFile, isPortfolioLike, isProject, isView } from '../component';
+import { isApplication, isFile, isProject, isView } from '../component';
 
-it.each([[isFile], [isView], [isProject], [isApplication], [isPortfolioLike]])(
+it.each([[isFile], [isView], [isProject], [isApplication]])(
   '%p should work properly',
   (utilityMethod: (componentQualifier: ComponentQualifier) => void) => {
     const results = Object.values(ComponentQualifier).reduce(
index b70eaca84f1fde379e354d625989649f4c67ee48..11f63dd2f8c4392067358b56abf20e05ee11cbf5 100644 (file)
@@ -18,6 +18,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import { ComponentQualifier } from '~sonar-aligned/types/component';
+import { isPortfolioLike } from '../sonar-aligned/helpers/component';
 import { Task } from './tasks';
 import { Component, LightComponent } from './types';
 
@@ -48,15 +49,6 @@ export interface TreeComponentWithPath extends TreeComponent {
   path: string;
 }
 
-export function isPortfolioLike(
-  componentQualifier?: string | ComponentQualifier,
-): componentQualifier is ComponentQualifier.Portfolio | ComponentQualifier.SubPortfolio {
-  return (
-    componentQualifier === ComponentQualifier.Portfolio ||
-    componentQualifier === ComponentQualifier.SubPortfolio
-  );
-}
-
 export function isApplication(
   componentQualifier?: string | ComponentQualifier,
 ): componentQualifier is ComponentQualifier.Application {