getBranchLikeDisplayName,
getBranchLikeQuery,
isMainBranch,
- isSameBranchLike,
} from '../../../helpers/branch-like';
import { parseDate, toNotSoISOString } from '../../../helpers/dates';
import { enhanceConditionWithMeasure, enhanceMeasuresWithMetrics } from '../../../helpers/measures';
this.loadHistory();
}
- componentDidUpdate(prevProps: Props) {
- if (
- this.props.component.key !== prevProps.component.key ||
- !isSameBranchLike(this.props.branch, prevProps.branch)
- ) {
- this.loadStatus();
- this.loadHistory();
- }
- }
-
componentWillUnmount() {
this.mounted = false;
}
export function LeakPeriodInfo({ leakPeriod }: LeakPeriodInfoProps) {
if (isApplicationPeriod(leakPeriod)) {
return <ApplicationLeakPeriodInfo leakPeriod={leakPeriod} />;
- } else {
- return <ProjectLeakPeriodInfo leakPeriod={leakPeriod} />;
}
+ return <ProjectLeakPeriodInfo leakPeriod={leakPeriod} />;
}
export default React.memo(LeakPeriodInfo);
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-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 } from '../../../../helpers/mocks/project-activity';
-import { mockMeasure, mockMetric } from '../../../../helpers/testMocks';
-import { GraphType } from '../../../../types/project-activity';
-import { ActivityPanel, ActivityPanelProps } from '../ActivityPanel';
-
-it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(shallowRender({ loading: true, analyses: undefined })).toMatchSnapshot();
-});
-
-it('should correctly pass the leak period start date', () => {
- // Leak period start is more recent than the oldest historic measure.
- let { leakPeriodDate } = shallowRender({
- leakPeriodDate: parseDate('2017-08-27T16:33:50+0200'),
- })
- .find(GraphsHistory)
- .props();
-
- expect(leakPeriodDate!.getTime()).toBe(1503844430000); /* 2017-08-27T16:33:50+0200 */
-
- // Leak period start is older than the oldest historic measure.
- ({ leakPeriodDate } = shallowRender({ leakPeriodDate: parseDate('2015-08-27T16:33:50+0200') })
- .find(GraphsHistory)
- .props());
-
- expect(leakPeriodDate!.getTime()).toBe(1477578830000); /* 2016-10-27T16:33:50+0200 */
-});
-
-function shallowRender(props: Partial<ActivityPanelProps> = {}) {
- return shallow(
- <ActivityPanel
- analyses={[mockAnalysis({ events: [mockAnalysisEvent()] }), mockAnalysis()]}
- branchLike={mockMainBranch()}
- component={mockComponent()}
- graph={GraphType.issues}
- loading={false}
- measuresHistory={[mockMeasure()].map((m) => ({
- ...m,
- history: [{ date: parseDate('2016-10-27T16:33:50+0200'), value: '20' }],
- }))}
- metrics={[mockMetric({ key: 'bugs' })]}
- onGraphChange={jest.fn()}
- {...props}
- />
- );
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockAnalysis } from '../../../../helpers/mocks/project-activity';
-import { ComponentQualifier } from '../../../../types/component';
-import { ProjectAnalysisEventCategory } from '../../../../types/project-activity';
-import { Analysis, AnalysisProps } from '../Analysis';
-
-it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(shallowRender({ qualifier: ComponentQualifier.Application })).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<AnalysisProps> = {}) {
- return shallow(
- <Analysis
- analysis={mockAnalysis({
- events: [
- { key: '1', category: ProjectAnalysisEventCategory.Other, name: 'test' },
- { key: '2', category: ProjectAnalysisEventCategory.Version, name: '6.5-SNAPSHOT' },
- ],
- })}
- qualifier={ComponentQualifier.Project}
- {...props}
- />
- );
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockApplicationPeriod } from '../../../../helpers/mocks/application';
-import {
- ApplicationLeakPeriodInfo,
- ApplicationLeakPeriodInfoProps,
-} from '../ApplicationLeakPeriodInfo';
-
-jest.mock('../../../../components/intl/DateFromNow');
-
-it('renders correctly', () => {
- const wrapper = shallowRender();
- expect(wrapper).toMatchSnapshot();
- expect(wrapper.find('DateFromNow').dive()).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<ApplicationLeakPeriodInfoProps> = {}) {
- return shallow(<ApplicationLeakPeriodInfo leakPeriod={mockApplicationPeriod()} {...props} />);
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 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 { screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import * as React from 'react';
+import selectEvent from 'react-select-event';
+import { getMeasuresWithPeriodAndMetrics } from '../../../../api/measures';
+import { getProjectActivity } from '../../../../api/projectActivity';
+import {
+ getApplicationQualityGate,
+ getQualityGateProjectStatus,
+} from '../../../../api/quality-gates';
+import CurrentUserContextProvider from '../../../../app/components/current-user/CurrentUserContextProvider';
+import { getActivityGraph, saveActivityGraph } from '../../../../components/activity-graph/utils';
+import { isDiffMetric } from '../../../../helpers/measures';
+import { mockMainBranch } from '../../../../helpers/mocks/branch-like';
+import { mockComponent } from '../../../../helpers/mocks/component';
+import { mockAnalysis } from '../../../../helpers/mocks/project-activity';
+import {
+ mockQualityGateApplicationStatus,
+ mockQualityGateProjectStatus,
+} from '../../../../helpers/mocks/quality-gates';
+import { mockLoggedInUser, mockPeriod } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { ComponentQualifier } from '../../../../types/component';
+import { MetricKey } from '../../../../types/metrics';
+import { GraphType } from '../../../../types/project-activity';
+import { CaycStatus, Measure, Metric } from '../../../../types/types';
+import BranchOverview, { BRANCH_OVERVIEW_ACTIVITY_GRAPH, NO_CI_DETECTED } from '../BranchOverview';
+
+jest.mock('../../../../api/measures', () => {
+ const { mockMeasure, mockMetric } = jest.requireActual('../../../../helpers/testMocks');
+ return {
+ getMeasuresWithPeriodAndMetrics: jest.fn((_, metricKeys: string[]) => {
+ const metrics: Metric[] = [];
+ const measures: Measure[] = [];
+ metricKeys.forEach((key) => {
+ if (key === 'unknown_metric') {
+ return;
+ }
+
+ let type;
+ if (/(coverage|duplication)$/.test(key)) {
+ type = 'PERCENT';
+ } else if (/_rating$/.test(key)) {
+ type = 'RATING';
+ } else {
+ type = 'INT';
+ }
+ metrics.push(mockMetric({ key, id: key, name: key, type }));
+ measures.push(
+ mockMeasure({
+ metric: key,
+ ...(isDiffMetric(key) ? { leak: '1' } : { period: undefined }),
+ })
+ );
+ });
+ return Promise.resolve({
+ component: {
+ measures,
+ name: 'foo',
+ },
+ metrics,
+ });
+ }),
+ };
+});
+
+jest.mock('../../../../api/quality-gates', () => {
+ const { mockQualityGateProjectStatus, mockQualityGateApplicationStatus } = jest.requireActual(
+ '../../../../helpers/mocks/quality-gates'
+ );
+ const { MetricKey } = jest.requireActual('../../../../types/metrics');
+ return {
+ getQualityGateProjectStatus: jest.fn().mockResolvedValue(
+ mockQualityGateProjectStatus({
+ status: 'ERROR',
+ conditions: [
+ {
+ actualValue: '2',
+ comparator: 'GT',
+ errorThreshold: '1',
+ metricKey: MetricKey.new_reliability_rating,
+ periodIndex: 1,
+ status: 'ERROR',
+ },
+ {
+ actualValue: '5',
+ comparator: 'GT',
+ errorThreshold: '2.0',
+ metricKey: MetricKey.bugs,
+ periodIndex: 0,
+ status: 'ERROR',
+ },
+ {
+ actualValue: '2',
+ comparator: 'GT',
+ errorThreshold: '1.0',
+ metricKey: 'unknown_metric',
+ periodIndex: 0,
+ status: 'ERROR',
+ },
+ ],
+ })
+ ),
+ getApplicationQualityGate: jest.fn().mockResolvedValue(mockQualityGateApplicationStatus()),
+ };
+});
+
+jest.mock('../../../../api/time-machine', () => {
+ const { MetricKey } = jest.requireActual('../../../../types/metrics');
+ return {
+ getAllTimeMachineData: jest.fn().mockResolvedValue({
+ measures: [
+ { metric: MetricKey.bugs, history: [{ date: '2019-01-05', value: '2.0' }] },
+ { metric: MetricKey.vulnerabilities, history: [{ date: '2019-01-05', value: '0' }] },
+ { metric: MetricKey.sqale_index, history: [{ date: '2019-01-01', value: '1.0' }] },
+ {
+ metric: MetricKey.duplicated_lines_density,
+ history: [{ date: '2019-01-02', value: '1.0' }],
+ },
+ { metric: MetricKey.ncloc, history: [{ date: '2019-01-03', value: '10000' }] },
+ { metric: MetricKey.coverage, history: [{ date: '2019-01-04', value: '95.5' }] },
+ ],
+ }),
+ };
+});
+
+jest.mock('../../../../api/projectActivity', () => {
+ const { mockAnalysis } = jest.requireActual('../../../../helpers/mocks/project-activity');
+ return {
+ getProjectActivity: jest.fn().mockResolvedValue({
+ analyses: [
+ mockAnalysis({ detectedCI: 'Cirrus CI' }),
+ mockAnalysis(),
+ mockAnalysis(),
+ mockAnalysis(),
+ mockAnalysis(),
+ ],
+ }),
+ };
+});
+
+jest.mock('../../../../api/application', () => ({
+ getApplicationDetails: jest.fn().mockResolvedValue({
+ branches: [],
+ key: 'key-1',
+ name: 'app',
+ projects: [
+ {
+ branch: 'foo',
+ key: 'KEY-P1',
+ name: 'P1',
+ },
+ ],
+ visibility: 'Private',
+ }),
+ getApplicationLeak: jest.fn().mockResolvedValue([
+ {
+ date: '2017-01-05',
+ project: 'foo',
+ projectName: 'Foo',
+ },
+ ]),
+}));
+
+jest.mock('../../../../components/activity-graph/utils', () => {
+ const { MetricKey } = jest.requireActual('../../../../types/metrics');
+ const { GraphType } = jest.requireActual('../../../../types/project-activity');
+ const original = jest.requireActual('../../../../components/activity-graph/utils');
+ return {
+ ...original,
+ getActivityGraph: jest.fn(() => ({ graph: GraphType.coverage })),
+ saveActivityGraph: jest.fn(),
+ getHistoryMetrics: jest.fn(() => [MetricKey.lines_to_cover, MetricKey.uncovered_lines]),
+ };
+});
+
+beforeEach(jest.clearAllMocks);
+
+describe('project overview', () => {
+ it('should show a successful QG', async () => {
+ const user = userEvent.setup();
+ jest
+ .mocked(getQualityGateProjectStatus)
+ .mockResolvedValueOnce(mockQualityGateProjectStatus({ status: 'OK' }));
+ renderBranchOverview();
+
+ // QG panel
+ expect(await screen.findByText('metric.level.OK')).toBeInTheDocument();
+ expect(screen.getByText('overview.quality_gate_all_conditions_passed')).toBeInTheDocument();
+ expect(
+ screen.queryByText('overview.quality_gate.conditions.cayc.warning')
+ ).not.toBeInTheDocument();
+
+ //Measures panel
+ expect(screen.getByText('metric.new_vulnerabilities.name')).toBeInTheDocument();
+
+ // go to overall
+ await user.click(screen.getByText('overview.overall_code'));
+
+ expect(screen.getByText('metric.vulnerabilities.name')).toBeInTheDocument();
+ });
+
+ it('should show a successful non-compliant QG', async () => {
+ jest
+ .mocked(getQualityGateProjectStatus)
+ .mockResolvedValueOnce(
+ mockQualityGateProjectStatus({ status: 'OK', caycStatus: CaycStatus.NonCompliant })
+ );
+
+ renderBranchOverview();
+
+ expect(await screen.findByText('metric.level.OK')).toBeInTheDocument();
+ expect(screen.getByText('overview.quality_gate.conditions.cayc.warning')).toBeInTheDocument();
+ });
+
+ it('should show a failed QG', async () => {
+ renderBranchOverview();
+
+ expect(await screen.findByText('metric.level.ERROR')).toBeInTheDocument();
+ expect(screen.getByText('overview.X_conditions_failed.2')).toBeInTheDocument();
+ });
+
+ it('should correctly show a project as empty', async () => {
+ jest.mocked(getMeasuresWithPeriodAndMetrics).mockResolvedValueOnce({
+ component: { key: '', name: '', qualifier: ComponentQualifier.Project, measures: [] },
+ metrics: [],
+ period: mockPeriod(),
+ });
+
+ renderBranchOverview();
+
+ expect(await screen.findByText('overview.project.main_branch_empty')).toBeInTheDocument();
+ });
+});
+
+describe('application overview', () => {
+ const component = mockComponent({
+ breadcrumbs: [mockComponent({ key: 'foo', qualifier: ComponentQualifier.Application })],
+ qualifier: ComponentQualifier.Application,
+ });
+
+ it('should show failed conditions for every project', async () => {
+ renderBranchOverview({ component });
+ expect(await screen.findByText('Foo')).toBeInTheDocument();
+ expect(screen.getByText('Bar')).toBeInTheDocument();
+ });
+
+ it("should show projects that don't have a compliant quality gate", async () => {
+ const appStatus = mockQualityGateApplicationStatus({
+ projects: [
+ {
+ key: '1',
+ name: 'first project',
+ conditions: [],
+ caycStatus: CaycStatus.NonCompliant,
+ status: 'OK',
+ },
+ {
+ key: '2',
+ name: 'second',
+ conditions: [],
+ caycStatus: CaycStatus.Compliant,
+ status: 'OK',
+ },
+ {
+ key: '3',
+ name: 'number 3',
+ conditions: [],
+ caycStatus: CaycStatus.NonCompliant,
+ status: 'OK',
+ },
+ {
+ key: '4',
+ name: 'four',
+ conditions: [
+ {
+ comparator: 'GT',
+ metric: MetricKey.bugs,
+ status: 'ERROR',
+ value: '3',
+ errorThreshold: '0',
+ },
+ ],
+ caycStatus: CaycStatus.NonCompliant,
+ status: 'ERROR',
+ },
+ ],
+ });
+ jest.mocked(getApplicationQualityGate).mockResolvedValueOnce(appStatus);
+
+ renderBranchOverview({ component });
+ expect(
+ await screen.findByText('overview.quality_gate.application.non_cayc.projects_x.3')
+ ).toBeInTheDocument();
+ expect(screen.getByText('first project')).toBeInTheDocument();
+ expect(screen.queryByText('second')).not.toBeInTheDocument();
+ expect(screen.getByText('number 3')).toBeInTheDocument();
+ });
+
+ it('should correctly show an app as empty', async () => {
+ jest.mocked(getMeasuresWithPeriodAndMetrics).mockResolvedValueOnce({
+ component: { key: '', name: '', qualifier: ComponentQualifier.Application, measures: [] },
+ metrics: [],
+ period: mockPeriod(),
+ });
+
+ renderBranchOverview({ component });
+
+ expect(await screen.findByText('portfolio.app.empty')).toBeInTheDocument();
+ });
+});
+
+it.each([
+ ['no analysis', [], true],
+ ['1 analysis, no CI data', [mockAnalysis()], false],
+ ['1 analysis, no CI detected', [mockAnalysis({ detectedCI: NO_CI_DETECTED })], false],
+ ['1 analysis, CI detected', [mockAnalysis({ detectedCI: 'Cirrus CI' })], true],
+])(
+ "should correctly flag a project that wasn't analyzed using a CI (%s)",
+ async (_, analyses, expected) => {
+ (getProjectActivity as jest.Mock).mockResolvedValueOnce({ analyses });
+
+ renderBranchOverview();
+
+ // wait for loading
+ await screen.findByText('overview.quality_gate');
+
+ expect(screen.queryByText('overview.project.next_steps.set_up_ci') === null).toBe(expected);
+ }
+);
+
+it('should correctly handle graph type storage', async () => {
+ renderBranchOverview();
+ expect(getActivityGraph).toHaveBeenCalledWith(BRANCH_OVERVIEW_ACTIVITY_GRAPH, 'foo');
+
+ const select = await screen.findByLabelText('project_activity.graphs.choose_type');
+ await selectEvent.select(select, `project_activity.graphs.${GraphType.issues}`);
+
+ expect(saveActivityGraph).toHaveBeenCalledWith(
+ BRANCH_OVERVIEW_ACTIVITY_GRAPH,
+ 'foo',
+ GraphType.issues
+ );
+});
+
+function renderBranchOverview(props: Partial<BranchOverview['props']> = {}) {
+ renderComponent(
+ <CurrentUserContextProvider currentUser={mockLoggedInUser()}>
+ <BranchOverview
+ branch={mockMainBranch()}
+ component={mockComponent({
+ breadcrumbs: [mockComponent({ key: 'foo' })],
+ key: 'foo',
+ name: 'Foo',
+ })}
+ {...props}
+ />
+ </CurrentUserContextProvider>
+ );
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import * as React from 'react';
-import selectEvent from 'react-select-event';
-import { getMeasuresWithPeriodAndMetrics } from '../../../../api/measures';
-import { getProjectActivity } from '../../../../api/projectActivity';
-import {
- getApplicationQualityGate,
- getQualityGateProjectStatus,
-} from '../../../../api/quality-gates';
-import CurrentUserContextProvider from '../../../../app/components/current-user/CurrentUserContextProvider';
-import { getActivityGraph, saveActivityGraph } from '../../../../components/activity-graph/utils';
-import { isDiffMetric } from '../../../../helpers/measures';
-import { mockMainBranch } from '../../../../helpers/mocks/branch-like';
-import { mockComponent } from '../../../../helpers/mocks/component';
-import { mockAnalysis } from '../../../../helpers/mocks/project-activity';
-import {
- mockQualityGateApplicationStatus,
- mockQualityGateProjectStatus,
-} from '../../../../helpers/mocks/quality-gates';
-import { mockLoggedInUser, mockPeriod } from '../../../../helpers/testMocks';
-import { renderComponent } from '../../../../helpers/testReactTestingUtils';
-import { ComponentQualifier } from '../../../../types/component';
-import { MetricKey } from '../../../../types/metrics';
-import { GraphType } from '../../../../types/project-activity';
-import { CaycStatus, Measure, Metric } from '../../../../types/types';
-import BranchOverview, { BRANCH_OVERVIEW_ACTIVITY_GRAPH, NO_CI_DETECTED } from '../BranchOverview';
-
-jest.mock('../../../../api/measures', () => {
- const { mockMeasure, mockMetric } = jest.requireActual('../../../../helpers/testMocks');
- return {
- getMeasuresWithPeriodAndMetrics: jest.fn((_, metricKeys: string[]) => {
- const metrics: Metric[] = [];
- const measures: Measure[] = [];
- metricKeys.forEach((key) => {
- if (key === 'unknown_metric') {
- return;
- }
-
- let type;
- if (/(coverage|duplication)$/.test(key)) {
- type = 'PERCENT';
- } else if (/_rating$/.test(key)) {
- type = 'RATING';
- } else {
- type = 'INT';
- }
- metrics.push(mockMetric({ key, id: key, name: key, type }));
- measures.push(
- mockMeasure({
- metric: key,
- ...(isDiffMetric(key) ? { leak: '1' } : { period: undefined }),
- })
- );
- });
- return Promise.resolve({
- component: {
- measures,
- name: 'foo',
- },
- metrics,
- });
- }),
- };
-});
-
-jest.mock('../../../../api/quality-gates', () => {
- const { mockQualityGateProjectStatus, mockQualityGateApplicationStatus } = jest.requireActual(
- '../../../../helpers/mocks/quality-gates'
- );
- const { MetricKey } = jest.requireActual('../../../../types/metrics');
- return {
- getQualityGateProjectStatus: jest.fn().mockResolvedValue(
- mockQualityGateProjectStatus({
- status: 'ERROR',
- conditions: [
- {
- actualValue: '2',
- comparator: 'GT',
- errorThreshold: '1',
- metricKey: MetricKey.new_reliability_rating,
- periodIndex: 1,
- status: 'ERROR',
- },
- {
- actualValue: '5',
- comparator: 'GT',
- errorThreshold: '2.0',
- metricKey: MetricKey.bugs,
- periodIndex: 0,
- status: 'ERROR',
- },
- {
- actualValue: '2',
- comparator: 'GT',
- errorThreshold: '1.0',
- metricKey: 'unknown_metric',
- periodIndex: 0,
- status: 'ERROR',
- },
- ],
- })
- ),
- getApplicationQualityGate: jest.fn().mockResolvedValue(mockQualityGateApplicationStatus()),
- };
-});
-
-jest.mock('../../../../api/time-machine', () => {
- const { MetricKey } = jest.requireActual('../../../../types/metrics');
- return {
- getAllTimeMachineData: jest.fn().mockResolvedValue({
- measures: [
- { metric: MetricKey.bugs, history: [{ date: '2019-01-05', value: '2.0' }] },
- { metric: MetricKey.vulnerabilities, history: [{ date: '2019-01-05', value: '0' }] },
- { metric: MetricKey.sqale_index, history: [{ date: '2019-01-01', value: '1.0' }] },
- {
- metric: MetricKey.duplicated_lines_density,
- history: [{ date: '2019-01-02', value: '1.0' }],
- },
- { metric: MetricKey.ncloc, history: [{ date: '2019-01-03', value: '10000' }] },
- { metric: MetricKey.coverage, history: [{ date: '2019-01-04', value: '95.5' }] },
- ],
- }),
- };
-});
-
-jest.mock('../../../../api/projectActivity', () => {
- const { mockAnalysis } = jest.requireActual('../../../../helpers/mocks/project-activity');
- return {
- getProjectActivity: jest.fn().mockResolvedValue({
- analyses: [
- mockAnalysis({ detectedCI: 'Cirrus CI' }),
- mockAnalysis(),
- mockAnalysis(),
- mockAnalysis(),
- mockAnalysis(),
- ],
- }),
- };
-});
-
-jest.mock('../../../../api/application', () => ({
- getApplicationDetails: jest.fn().mockResolvedValue({
- branches: [],
- key: 'key-1',
- name: 'app',
- projects: [
- {
- branch: 'foo',
- key: 'KEY-P1',
- name: 'P1',
- },
- ],
- visibility: 'Private',
- }),
- getApplicationLeak: jest.fn().mockResolvedValue([
- {
- date: '2017-01-05',
- project: 'foo',
- projectName: 'Foo',
- },
- ]),
-}));
-
-jest.mock('../../../../components/activity-graph/utils', () => {
- const { MetricKey } = jest.requireActual('../../../../types/metrics');
- const { GraphType } = jest.requireActual('../../../../types/project-activity');
- const original = jest.requireActual('../../../../components/activity-graph/utils');
- return {
- ...original,
- getActivityGraph: jest.fn(() => ({ graph: GraphType.coverage })),
- saveActivityGraph: jest.fn(),
- getHistoryMetrics: jest.fn(() => [MetricKey.lines_to_cover, MetricKey.uncovered_lines]),
- };
-});
-
-beforeEach(jest.clearAllMocks);
-
-describe('project overview', () => {
- it('should show a successful QG', async () => {
- const user = userEvent.setup();
- jest
- .mocked(getQualityGateProjectStatus)
- .mockResolvedValueOnce(mockQualityGateProjectStatus({ status: 'OK' }));
- renderBranchOverview();
-
- // QG panel
- expect(await screen.findByText('metric.level.OK')).toBeInTheDocument();
- expect(screen.getByText('overview.quality_gate_all_conditions_passed')).toBeInTheDocument();
- expect(
- screen.queryByText('overview.quality_gate.conditions.cayc.warning')
- ).not.toBeInTheDocument();
-
- //Measures panel
- expect(screen.getByText('metric.new_vulnerabilities.name')).toBeInTheDocument();
-
- // go to overall
- await user.click(screen.getByText('overview.overall_code'));
-
- expect(screen.getByText('metric.vulnerabilities.name')).toBeInTheDocument();
- });
-
- it('should show a successful non-compliant QG', async () => {
- jest
- .mocked(getQualityGateProjectStatus)
- .mockResolvedValueOnce(
- mockQualityGateProjectStatus({ status: 'OK', caycStatus: CaycStatus.NonCompliant })
- );
-
- renderBranchOverview();
-
- expect(await screen.findByText('metric.level.OK')).toBeInTheDocument();
- expect(screen.getByText('overview.quality_gate.conditions.cayc.warning')).toBeInTheDocument();
- });
-
- it('should show a failed QG', async () => {
- renderBranchOverview();
-
- expect(await screen.findByText('metric.level.ERROR')).toBeInTheDocument();
- expect(screen.getByText('overview.X_conditions_failed.2')).toBeInTheDocument();
- });
-
- it('should correctly show a project as empty', async () => {
- jest.mocked(getMeasuresWithPeriodAndMetrics).mockResolvedValueOnce({
- component: { key: '', name: '', qualifier: ComponentQualifier.Project, measures: [] },
- metrics: [],
- period: mockPeriod(),
- });
-
- renderBranchOverview();
-
- expect(await screen.findByText('overview.project.main_branch_empty')).toBeInTheDocument();
- });
-});
-
-describe('application overview', () => {
- const component = mockComponent({
- breadcrumbs: [mockComponent({ key: 'foo', qualifier: ComponentQualifier.Application })],
- qualifier: ComponentQualifier.Application,
- });
-
- it('should show failed conditions for every project', async () => {
- renderBranchOverview({ component });
- expect(await screen.findByText('Foo')).toBeInTheDocument();
- expect(screen.getByText('Bar')).toBeInTheDocument();
- });
-
- it("should show projects that don't have a compliant quality gate", async () => {
- const appStatus = mockQualityGateApplicationStatus({
- projects: [
- {
- key: '1',
- name: 'first project',
- conditions: [],
- caycStatus: CaycStatus.NonCompliant,
- status: 'OK',
- },
- {
- key: '2',
- name: 'second',
- conditions: [],
- caycStatus: CaycStatus.Compliant,
- status: 'OK',
- },
- {
- key: '3',
- name: 'number 3',
- conditions: [],
- caycStatus: CaycStatus.NonCompliant,
- status: 'OK',
- },
- {
- key: '4',
- name: 'four',
- conditions: [
- {
- comparator: 'GT',
- metric: MetricKey.bugs,
- status: 'ERROR',
- value: '3',
- errorThreshold: '0',
- },
- ],
- caycStatus: CaycStatus.NonCompliant,
- status: 'ERROR',
- },
- ],
- });
- jest.mocked(getApplicationQualityGate).mockResolvedValueOnce(appStatus);
-
- renderBranchOverview({ component });
- expect(
- await screen.findByText('overview.quality_gate.application.non_cayc.projects_x.3')
- ).toBeInTheDocument();
- expect(screen.getByText('first project')).toBeInTheDocument();
- expect(screen.queryByText('second')).not.toBeInTheDocument();
- expect(screen.getByText('number 3')).toBeInTheDocument();
- });
-
- it('should correctly show an app as empty', async () => {
- jest.mocked(getMeasuresWithPeriodAndMetrics).mockResolvedValueOnce({
- component: { key: '', name: '', qualifier: ComponentQualifier.Application, measures: [] },
- metrics: [],
- period: mockPeriod(),
- });
-
- renderBranchOverview({ component });
-
- expect(await screen.findByText('portfolio.app.empty')).toBeInTheDocument();
- });
-});
-
-it.each([
- ['no analysis', [], true],
- ['1 analysis, no CI data', [mockAnalysis()], false],
- ['1 analysis, no CI detected', [mockAnalysis({ detectedCI: NO_CI_DETECTED })], false],
- ['1 analysis, CI detected', [mockAnalysis({ detectedCI: 'Cirrus CI' })], true],
-])(
- "should correctly flag a project that wasn't analyzed using a CI (%s)",
- async (_, analyses, expected) => {
- (getProjectActivity as jest.Mock).mockResolvedValueOnce({ analyses });
-
- renderBranchOverview();
-
- // wait for loading
- await screen.findByText('overview.quality_gate');
-
- expect(screen.queryByText('overview.project.next_steps.set_up_ci') === null).toBe(expected);
- }
-);
-
-it('should correctly handle graph type storage', async () => {
- renderBranchOverview();
- expect(getActivityGraph).toHaveBeenCalledWith(BRANCH_OVERVIEW_ACTIVITY_GRAPH, 'foo');
-
- const select = await screen.findByLabelText('project_activity.graphs.choose_type');
- await selectEvent.select(select, `project_activity.graphs.${GraphType.issues}`);
-
- expect(saveActivityGraph).toHaveBeenCalledWith(
- BRANCH_OVERVIEW_ACTIVITY_GRAPH,
- 'foo',
- GraphType.issues
- );
-});
-
-function renderBranchOverview(props: Partial<BranchOverview['props']> = {}) {
- renderComponent(
- <CurrentUserContextProvider currentUser={mockLoggedInUser()}>
- <BranchOverview
- branch={mockMainBranch()}
- component={mockComponent({
- breadcrumbs: [mockComponent({ key: 'foo' })],
- key: 'foo',
- name: 'Foo',
- })}
- {...props}
- />
- </CurrentUserContextProvider>
- );
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockMainBranch } from '../../../../helpers/mocks/branch-like';
-import { mockComponent } from '../../../../helpers/mocks/component';
-import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks';
-import { MetricKey } from '../../../../types/metrics';
-import { DrilldownMeasureValue, DrilldownMeasureValueProps } from '../DrilldownMeasureValue';
-
-it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot('default');
- expect(shallowRender({ metric: MetricKey.bugs })).toMatchSnapshot('measure not found');
-});
-
-function shallowRender(props: Partial<DrilldownMeasureValueProps> = {}) {
- return shallow(
- <DrilldownMeasureValue
- branchLike={mockMainBranch()}
- component={mockComponent()}
- measures={[mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.tests }) })]}
- metric={MetricKey.tests}
- {...props}
- />
- );
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { AnalysisEvent, ProjectAnalysisEventCategory } from '../../../../types/project-activity';
-import { Event } from '../Event';
-
-it('should render an event correctly', () => {
- expect(
- shallow(
- <Event event={{ key: '1', category: ProjectAnalysisEventCategory.Other, name: 'test' }} />
- )
- ).toMatchSnapshot();
-});
-
-it('should render a version correctly', () => {
- expect(
- shallow(
- <Event
- event={{ key: '2', category: ProjectAnalysisEventCategory.Version, name: '6.5-SNAPSHOT' }}
- />
- )
- ).toMatchSnapshot();
-});
-
-it('should render rich quality gate event', () => {
- const event: AnalysisEvent = {
- category: ProjectAnalysisEventCategory.QualityGate,
- key: 'foo1234',
- name: '',
- qualityGate: {
- failing: [{ branch: 'master', key: 'foo', name: 'Foo' }],
- status: 'ERROR',
- stillFailing: true,
- },
- };
- expect(shallow(<Event event={event} />)).toMatchSnapshot();
-});
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockProjectAlmBindingResponse } from '../../../../helpers/mocks/alm-settings';
-import { mockComponent } from '../../../../helpers/mocks/component';
-import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks';
-import { ComponentQualifier } from '../../../../types/component';
-import {
- FirstAnalysisNextStepsNotif,
- FirstAnalysisNextStepsNotifProps,
-} from '../FirstAnalysisNextStepsNotif';
-
-it('should render correctly', () => {
- expect(shallowRender({ currentUser: mockCurrentUser() }).type()).toBeNull();
- expect(
- shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Application }),
- }).type()
- ).toBeNull();
- expect(shallowRender({ detectedCIOnLastAnalysis: false })).toMatchSnapshot(
- 'show prompt to configure CI'
- );
- expect(
- shallowRender({
- projectBinding: undefined,
- })
- ).toMatchSnapshot('show prompt to configure PR decoration, regular user');
- expect(
- shallowRender({
- component: mockComponent({ configuration: { showSettings: true } }),
- projectBinding: undefined,
- })
- ).toMatchSnapshot('show prompt to configure PR decoration, project admin');
- expect(
- shallowRender({
- projectBinding: undefined,
- detectedCIOnLastAnalysis: false,
- })
- ).toMatchSnapshot('show prompt to configure PR decoration + CI, regular user');
- expect(
- shallowRender({
- component: mockComponent({ configuration: { showSettings: true } }),
- projectBinding: undefined,
- detectedCIOnLastAnalysis: false,
- })
- ).toMatchSnapshot('show prompt to configure PR decoration + CI, project admin');
-});
-
-function shallowRender(props: Partial<FirstAnalysisNextStepsNotifProps> = {}) {
- return shallow<FirstAnalysisNextStepsNotifProps>(
- <FirstAnalysisNextStepsNotif
- component={mockComponent()}
- branchesEnabled={true}
- currentUser={mockLoggedInUser()}
- detectedCIOnLastAnalysis={true}
- projectBinding={mockProjectAlmBindingResponse()}
- {...props}
- />
- );
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockApplicationPeriod } from '../../../../helpers/mocks/application';
-import { mockPeriod } from '../../../../helpers/testMocks';
-import { LeakPeriodInfo, LeakPeriodInfoProps } from '../LeakPeriodInfo';
-
-it('renders correctly for projects', () => {
- expect(shallowRender()).toMatchSnapshot();
-});
-
-it('renders correctly for applications', () => {
- expect(shallowRender({ leakPeriod: mockApplicationPeriod() })).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<LeakPeriodInfoProps> = {}) {
- return shallow(<LeakPeriodInfo leakPeriod={mockPeriod()} {...props} />);
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import BoxedTabs from '../../../../components/controls/BoxedTabs';
-import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like';
-import { mockComponent } from '../../../../helpers/mocks/component';
-import {
- mockLocation,
- mockMeasureEnhanced,
- mockMetric,
- mockPeriod,
-} from '../../../../helpers/testMocks';
-import { ComponentQualifier } from '../../../../types/component';
-import { MetricKey } from '../../../../types/metrics';
-import { MeasuresPanel, MeasuresPanelProps, MeasuresPanelTabs } from '../MeasuresPanel';
-
-jest.mock('react', () => {
- return {
- ...jest.requireActual('react'),
- useEffect: jest.fn().mockImplementation((f) => f()),
- };
-});
-
-it('should render correctly for projects', () => {
- const wrapper = shallowRender();
- expect(wrapper).toMatchSnapshot('default');
- wrapper.find(BoxedTabs).prop<Function>('onSelect')(MeasuresPanelTabs.Overall);
- expect(wrapper).toMatchSnapshot('overall');
-});
-
-it('should render correctly for applications', () => {
- const wrapper = shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Application }),
- });
- expect(wrapper).toMatchSnapshot('default');
- wrapper.find(BoxedTabs).prop<Function>('onSelect')(MeasuresPanelTabs.Overall);
- expect(wrapper).toMatchSnapshot('overall');
-});
-
-it('should render correctly if there is no new code measures', () => {
- const wrapper = shallowRender({
- measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
- ],
- });
- wrapper.find(BoxedTabs).prop<Function>('onSelect')(MeasuresPanelTabs.New);
- expect(wrapper).toMatchSnapshot();
-});
-
-it('should render correctly if branch is misconfigured', () => {
- const wrapper = shallowRender({
- branch: mockBranch({ name: 'own-reference' }),
- measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
- ],
- period: mockPeriod({ date: undefined, mode: 'REFERENCE_BRANCH', parameter: 'own-reference' }),
- });
- wrapper.find(BoxedTabs).prop<Function>('onSelect')(MeasuresPanelTabs.New);
- expect(wrapper).toMatchSnapshot('hide settings');
-
- wrapper.setProps({ component: mockComponent({ configuration: { showSettings: true } }) });
- expect(wrapper).toMatchSnapshot('show settings');
-});
-
-it('should render correctly if there is no coverage', () => {
- expect(
- shallowRender({
- measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) }),
- ],
- })
- ).toMatchSnapshot();
-});
-
-it('should render correctly if the data is still loading', () => {
- expect(shallowRender({ loading: true })).toMatchSnapshot();
-});
-
-it('should render correctly when code scope is overall code', () => {
- expect(
- shallowRender({
- location: mockLocation({ pathname: '/dashboard', query: { code_scope: 'overall' } }),
- })
- ).toMatchSnapshot();
-});
-
-it('should render correctly when code scope is new code', () => {
- expect(
- shallowRender({
- location: mockLocation({ pathname: '/dashboard', query: { code_scope: 'new' } }),
- })
- ).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<MeasuresPanelProps> = {}) {
- return shallow<MeasuresPanelProps>(
- <MeasuresPanel
- branch={mockMainBranch()}
- component={mockComponent()}
- measures={[
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) }),
- ]}
- location={mockLocation()}
- {...props}
- />
- );
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like';
-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';
-
-it('should render correctly if the project has no lines of code', () => {
- const wrapper = shallowRender();
- expect(wrapper.children().text()).toBe('overview.project.main_branch_no_lines_of_code');
-
- wrapper.setProps({ branchLike: mockBranch({ name: 'branch-foo' }) });
- expect(wrapper.children().text()).toBe('overview.project.branch_X_no_lines_of_code.branch-foo');
-
- wrapper.setProps({ branchLike: undefined });
- expect(wrapper.children().text()).toBe('overview.project.no_lines_of_code');
-});
-
-it('should correctly if the project is empty', () => {
- const wrapper = shallowRender({ measures: [] });
- expect(wrapper.children().text()).toBe('overview.project.main_branch_empty');
-
- wrapper.setProps({ branchLike: mockBranch({ name: 'branch-foo' }) });
- expect(wrapper.children().text()).toBe('overview.project.branch_X_empty.branch-foo');
-
- wrapper.setProps({ branchLike: undefined });
- expect(wrapper.children().text()).toBe('overview.project.empty');
-});
-
-it('should render correctly if the application is empty or has no lines of code', () => {
- const wrapper = shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Application }),
- measures: [mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.projects }) })],
- });
- expect(wrapper.children().text()).toBe('portfolio.app.no_lines_of_code');
-
- wrapper.setProps({ measures: [] });
- expect(wrapper.children().text()).toBe('portfolio.app.empty');
-});
-
-function shallowRender(props = {}) {
- return shallow(
- <NoCodeWarning
- branchLike={mockMainBranch()}
- component={mockComponent()}
- measures={[mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) })]}
- {...props}
- />
- );
-}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { screen } from '@testing-library/react';
import { differenceInDays } from 'date-fns';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IntlShape } from 'react-intl';
import { mockPeriod } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { Period } from '../../../../types/types';
import { ProjectLeakPeriodInfo } from '../ProjectLeakPeriodInfo';
return { ...actual, differenceInDays: jest.fn().mockReturnValue(10) };
});
-it('should render correctly for 10 days', () => {
- expect(shallowRender({ mode: 'days', parameter: '10' })).toMatchSnapshot();
+it('should render correctly for 10 days', async () => {
+ renderProjectLeakPeriodInfo({ mode: 'days', parameter: '10' });
+ expect(await screen.findByText('overview.period.days.10')).toBeInTheDocument();
});
-it('should render correctly for a specific date', () => {
- expect(shallowRender({ mode: 'date', parameter: '2013-01-01' })).toMatchSnapshot();
+it('should render correctly for a specific date', async () => {
+ renderProjectLeakPeriodInfo({ mode: 'date', parameter: '2013-01-01' });
+ expect(await screen.findByText('overview.period.date.formatted.2013-01-01')).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_x\..*ago/)).toBeInTheDocument();
});
-it('should render correctly for a specific version', () => {
- expect(shallowRender({ mode: 'version', parameter: '0.1' })).toMatchSnapshot();
+it('should render correctly for a specific version', async () => {
+ renderProjectLeakPeriodInfo({ mode: 'version', parameter: '0.1' });
+ expect(await screen.findByText('overview.period.version.0.1')).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_x\..*ago/)).toBeInTheDocument();
});
-it('should render correctly for "previous_version"', () => {
- expect(shallowRender({ mode: 'previous_version' })).toMatchSnapshot();
+it('should render correctly for "previous_version"', async () => {
+ renderProjectLeakPeriodInfo({ mode: 'previous_version' });
+ expect(await screen.findByText('overview.period.previous_version_only_date')).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_x\..*ago/)).toBeInTheDocument();
});
-it('should render correctly for "previous_analysis"', () => {
- expect(shallowRender({ mode: 'previous_analysis' })).toMatchSnapshot();
+it('should render correctly for "previous_analysis"', async () => {
+ renderProjectLeakPeriodInfo({ mode: 'previous_analysis' });
+ expect(await screen.findByText('overview.period.previous_analysis.')).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.previous_analysis_x\..*ago/)).toBeInTheDocument();
});
-it('should render correctly for "REFERENCE_BRANCH"', () => {
- expect(shallowRender({ mode: 'REFERENCE_BRANCH', parameter: 'master' })).toMatchSnapshot();
+it('should render correctly for "REFERENCE_BRANCH"', async () => {
+ renderProjectLeakPeriodInfo({
+ mode: 'REFERENCE_BRANCH',
+ parameter: 'master',
+ });
+ expect(await screen.findByText('overview.period.reference_branch.master')).toBeInTheDocument();
});
-it('should render correctly for "manual_baseline"', () => {
- expect(shallowRender({ mode: 'manual_baseline' })).toMatchSnapshot();
- expect(shallowRender({ mode: 'manual_baseline', parameter: '1.1.2' })).toMatchSnapshot();
+it('should render correctly for "manual_baseline"', async () => {
+ const rtl = renderProjectLeakPeriodInfo({ mode: 'manual_baseline' });
+
+ expect(
+ await screen.findByText(/overview\.period\.manual_baseline\.formattedTime\..*/)
+ ).toBeInTheDocument();
+ rtl.unmount();
+ renderProjectLeakPeriodInfo({ mode: 'manual_baseline', parameter: '1.1.2' });
+ expect(await screen.findByText('overview.period.manual_baseline.1.1.2')).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_x\..*ago/)).toBeInTheDocument();
});
-it('should render a more precise date', () => {
+it('should render a more precise date', async () => {
(differenceInDays as jest.Mock<any>).mockReturnValueOnce(0);
- expect(
- shallowRender({ date: '2018-08-17T00:00:00+0200', mode: 'previous_version' })
- ).toMatchSnapshot();
+ renderProjectLeakPeriodInfo({
+ date: '2018-08-17T00:00:00+0200',
+ mode: 'previous_version',
+ });
+ expect(await screen.findByText('overview.period.previous_version_only_date')).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_x\..*ago/)).toBeInTheDocument();
});
-function shallowRender(period: Partial<Period> = {}) {
- return shallow(
+function renderProjectLeakPeriodInfo(period: Partial<Period> = {}) {
+ return renderComponent(
<ProjectLeakPeriodInfo
intl={
{
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockComponent } from '../../../../helpers/mocks/component';
-import {
- mockQualityGateStatus,
- mockQualityGateStatusConditionEnhanced,
-} from '../../../../helpers/mocks/quality-gates';
-import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks';
-import { ComponentQualifier } from '../../../../types/component';
-import { MetricKey } from '../../../../types/metrics';
-import { QualityGatePanel, QualityGatePanelProps } from '../QualityGatePanel';
-
-it('should render correctly for projects', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(
- shallowRender({ qgStatuses: [mockQualityGateStatus({ status: 'OK', failedConditions: [] })] })
- ).toMatchSnapshot();
-
- const wrapper = shallowRender({
- qgStatuses: [mockQualityGateStatus({ ignoredConditions: true })],
- });
- expect(wrapper).toMatchSnapshot();
-});
-
-it('should render correctly for applications', () => {
- expect(
- shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Application }),
- qgStatuses: [
- mockQualityGateStatus(),
- mockQualityGateStatus({
- failedConditions: [
- mockQualityGateStatusConditionEnhanced(),
- mockQualityGateStatusConditionEnhanced({
- measure: mockMeasureEnhanced({
- metric: mockMetric({ key: MetricKey.new_code_smells }),
- }),
- metric: MetricKey.new_code_smells,
- }),
- ],
- }),
- ],
- })
- ).toMatchSnapshot();
-
- const wrapper = shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Application }),
- qgStatuses: [
- mockQualityGateStatus(),
- mockQualityGateStatus({
- status: 'OK',
- failedConditions: [],
- }),
- ],
- });
- expect(wrapper).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<QualityGatePanelProps> = {}) {
- return shallow(
- <QualityGatePanel
- component={mockComponent()}
- qgStatuses={[mockQualityGateStatus()]}
- {...props}
- />
- );
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { 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 { ComponentQualifier } from '../../../../types/component';
-import { MetricKey } from '../../../../types/metrics';
-import { CaycStatus } from '../../../../types/types';
-import { QualityGatePanelSection, QualityGatePanelSectionProps } from '../QualityGatePanelSection';
-
-it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(
- shallowRender({
- qgStatus: mockQualityGateStatus({
- failedConditions: [],
- status: 'OK',
- caycStatus: CaycStatus.Compliant,
- }),
- }).type()
- ).toBeNull();
- expect(
- shallowRender({ component: mockComponent({ qualifier: ComponentQualifier.Application }) })
- ).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<QualityGatePanelSectionProps> = {}) {
- return shallow(
- <QualityGatePanelSection
- branchLike={mockMainBranch()}
- component={mockComponent()}
- qgStatus={mockQualityGateStatus({
- failedConditions: [
- mockQualityGateStatusConditionEnhanced({ metric: MetricKey.bugs }),
- mockQualityGateStatusConditionEnhanced({ metric: MetricKey.new_bugs }),
- ],
- status: 'ERROR',
- caycStatus: CaycStatus.NonCompliant,
- })}
- {...props}
- />
- );
-}
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<div
- className="overview-panel big-spacer-top"
- data-test="overview__activity-panel"
->
- <h2
- className="overview-panel-title"
- >
- overview.activity
- </h2>
- <div
- className="overview-panel-content"
- >
- <div
- className="display-flex-row"
- >
- <div
- className="display-flex-column flex-1"
- >
- <div
- className="overview-panel-padded display-flex-column flex-1"
- >
- <GraphsHeader
- graph="issues"
- metrics={
- [
- {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- ]
- }
- onUpdateGraph={[MockFunction]}
- />
- <GraphsHistory
- analyses={[]}
- ariaLabel="overview.activity.graph_shows_data_for_x.metric.bugs.name, metric.code_smells.name, metric.vulnerabilities.name"
- canShowDataAsTable={false}
- graph="issues"
- graphs={
- [
- [
- {
- "data": [
- {
- "x": 2016-10-27T14:33:50.000Z,
- "y": 20,
- },
- ],
- "name": "bugs",
- "translatedName": "bugs",
- "type": "PERCENT",
- },
- ],
- ]
- }
- loading={false}
- measuresHistory={
- [
- {
- "bestValue": true,
- "history": [
- {
- "date": 2016-10-27T14:33:50.000Z,
- "value": "20",
- },
- ],
- "metric": "bugs",
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- series={
- [
- {
- "data": [
- {
- "x": 2016-10-27T14:33:50.000Z,
- "y": 20,
- },
- ],
- "name": "bugs",
- "translatedName": "bugs",
- "type": "PERCENT",
- },
- ]
- }
- />
- </div>
- <div
- className="overview-panel-padded bordered-top text-right"
- >
- <ActivityLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component="my-project"
- graph="issues"
- />
- </div>
- </div>
- <div
- className="overview-panel-padded bordered-left width-30"
- >
- <div
- data-test="overview__activity-analyses"
- >
- <DeferredSpinner
- className="spacer-top spacer-left"
- loading={false}
- >
- <ul
- className="spacer-top spacer-left"
- >
- <Memo(Analysis)
- analysis={
- {
- "date": "2017-03-01T09:36:01+0100",
- "events": [
- {
- "category": "QUALITY_GATE",
- "description": "Lorem ipsum dolor sit amet",
- "key": "E11",
- "name": "Lorem ipsum",
- "qualityGate": {
- "failing": [
- {
- "branch": "master",
- "key": "foo",
- "name": "Foo",
- },
- {
- "branch": "feature/bar",
- "key": "bar",
- "name": "Bar",
- },
- ],
- "status": "ERROR",
- "stillFailing": true,
- },
- },
- ],
- "key": "foo",
- "projectVersion": "1.0",
- }
- }
- key="foo"
- qualifier="TRK"
- />
- </ul>
- </DeferredSpinner>
- </div>
- </div>
- </div>
- </div>
-</div>
-`;
-
-exports[`should render correctly 2`] = `
-<div
- className="overview-panel big-spacer-top"
- data-test="overview__activity-panel"
->
- <h2
- className="overview-panel-title"
- >
- overview.activity
- </h2>
- <div
- className="overview-panel-content"
- >
- <div
- className="display-flex-row"
- >
- <div
- className="display-flex-column flex-1"
- >
- <div
- className="overview-panel-padded display-flex-column flex-1"
- >
- <GraphsHeader
- graph="issues"
- metrics={
- [
- {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- ]
- }
- onUpdateGraph={[MockFunction]}
- />
- <GraphsHistory
- analyses={[]}
- ariaLabel="overview.activity.graph_shows_data_for_x.metric.bugs.name, metric.code_smells.name, metric.vulnerabilities.name"
- canShowDataAsTable={false}
- graph="issues"
- graphs={
- [
- [
- {
- "data": [
- {
- "x": 2016-10-27T14:33:50.000Z,
- "y": 20,
- },
- ],
- "name": "bugs",
- "translatedName": "bugs",
- "type": "PERCENT",
- },
- ],
- ]
- }
- loading={true}
- measuresHistory={
- [
- {
- "bestValue": true,
- "history": [
- {
- "date": 2016-10-27T14:33:50.000Z,
- "value": "20",
- },
- ],
- "metric": "bugs",
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- series={
- [
- {
- "data": [
- {
- "x": 2016-10-27T14:33:50.000Z,
- "y": 20,
- },
- ],
- "name": "bugs",
- "translatedName": "bugs",
- "type": "PERCENT",
- },
- ]
- }
- />
- </div>
- <div
- className="overview-panel-padded bordered-top text-right"
- >
- <ActivityLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component="my-project"
- graph="issues"
- />
- </div>
- </div>
- <div
- className="overview-panel-padded bordered-left width-30"
- >
- <div
- data-test="overview__activity-analyses"
- >
- <DeferredSpinner
- className="spacer-top spacer-left"
- loading={true}
- >
- <p
- className="spacer-top spacer-left note"
- >
- no_results
- </p>
- </DeferredSpinner>
- </div>
- </div>
- </div>
- </div>
-</div>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<li
- className="overview-analysis"
->
- <div
- className="small little-spacer-bottom"
- >
- <strong>
- <DateTimeFormatter
- date="2017-03-01T09:36:01+0100"
- />
- </strong>
- </div>
- <div
- className="overview-activity-events"
- >
- <Memo(Event)
- event={
- {
- "category": "VERSION",
- "key": "2",
- "name": "6.5-SNAPSHOT",
- }
- }
- key="2"
- />
- <Memo(Event)
- event={
- {
- "category": "OTHER",
- "key": "1",
- "name": "test",
- }
- }
- key="1"
- />
- </div>
-</li>
-`;
-
-exports[`should render correctly 2`] = `
-<li
- className="overview-analysis"
->
- <div
- className="small little-spacer-bottom"
- >
- <strong>
- <DateTimeFormatter
- date="2017-03-01T09:36:01+0100"
- />
- </strong>
- </div>
- <div
- className="overview-activity-events"
- >
- <Memo(Event)
- event={
- {
- "category": "VERSION",
- "key": "2",
- "name": "6.5-SNAPSHOT",
- }
- }
- key="2"
- />
- <Memo(Event)
- event={
- {
- "category": "OTHER",
- "key": "1",
- "name": "test",
- }
- }
- key="1"
- />
- </div>
-</li>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders correctly 1`] = `
-<div
- className="note spacer-top display-inline-flex-center"
->
- <DateFromNow
- date="2017-10-01"
- >
- <Component />
- </DateFromNow>
- <HelpTooltip
- className="little-spacer-left"
- overlay="overview.max_new_code_period_from_x.Foo"
- />
-</div>
-`;
-
-exports[`renders correctly 2`] = `"overview.started_x.2017-10-01"`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly: default 1`] = `
-<div
- className="display-flex-column display-flex-center"
->
- <span>
- <DrilldownLink
- ariaLabel="overview.see_more_details_on_x_y.1.0.metric.tests.name"
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- className="overview-measures-value text-light"
- component="my-project"
- metric="tests"
- >
- 1
- </DrilldownLink>
- </span>
- <span
- className="spacer-top"
- >
- tests
- </span>
-</div>
-`;
-
-exports[`should render correctly: measure not found 1`] = `
-<div
- className="display-flex-column display-flex-center"
->
- <span
- className="overview-measures-value text-light"
- >
- -
- </span>
- <span
- className="spacer-top"
- >
- bugs
- </span>
-</div>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render a version correctly 1`] = `
-<span
- className="overview-analysis-event analysis-version text-ellipsis max-width-80"
- title="version 6.5-SNAPSHOT"
->
- 6.5-SNAPSHOT
-</span>
-`;
-
-exports[`should render an event correctly 1`] = `
-<div
- className="overview-analysis-event"
->
- <span
- className="note text-ellipsis width-80"
- >
- event.category.OTHER
- :
- </span>
-
- <strong>
- test
- </strong>
-</div>
-`;
-
-exports[`should render rich quality gate event 1`] = `
-<div
- className="overview-analysis-event"
->
- <span
- className="note"
- >
- event.category.QUALITY_GATE
- :
- </span>
-
- <FormattedMessage
- defaultMessage="event.quality_gate.still_x"
- id="event.quality_gate.still_x"
- values={
- {
- "status": <Level
- level="ERROR"
- small={true}
- />,
- }
- }
- />
-</div>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly: show prompt to configure CI 1`] = `
-<DismissableAlert
- alertKey="config_ci_pr_deco.my-project"
- variant="info"
->
- <FormattedMessage
- defaultMessage="overview.project.next_steps.set_up_ci"
- id="overview.project.next_steps.set_up_ci"
- values={
- {
- "link": <ForwardRef(Link)
- to={
- {
- "pathname": "/tutorials",
- "search": "?id=my-project",
- }
- }
- >
- overview.project.next_steps.links.set_up_ci
- </ForwardRef(Link)>,
- }
- }
- />
-</DismissableAlert>
-`;
-
-exports[`should render correctly: show prompt to configure PR decoration + CI, project admin 1`] = `
-<DismissableAlert
- alertKey="config_ci_pr_deco.my-project"
- variant="info"
->
- <FormattedMessage
- defaultMessage="overview.project.next_steps.set_up_pr_deco_and_ci.admin"
- id="overview.project.next_steps.set_up_pr_deco_and_ci.admin"
- values={
- {
- "link_ci": <ForwardRef(Link)
- to={
- {
- "pathname": "/tutorials",
- "search": "?id=my-project",
- }
- }
- >
- overview.project.next_steps.links.set_up_ci
- </ForwardRef(Link)>,
- "link_project_settings": <ForwardRef(Link)
- to={
- {
- "pathname": "/project/settings",
- "search": "?id=my-project&category=pull_request_decoration_binding",
- }
- }
- >
- overview.project.next_steps.links.project_settings
- </ForwardRef(Link)>,
- }
- }
- />
-</DismissableAlert>
-`;
-
-exports[`should render correctly: show prompt to configure PR decoration + CI, regular user 1`] = `
-<DismissableAlert
- alertKey="config_ci_pr_deco.my-project"
- variant="info"
->
- <FormattedMessage
- defaultMessage="overview.project.next_steps.set_up_pr_deco_and_ci"
- id="overview.project.next_steps.set_up_pr_deco_and_ci"
- values={
- {
- "link_ci": <ForwardRef(Link)
- to={
- {
- "pathname": "/tutorials",
- "search": "?id=my-project",
- }
- }
- >
- overview.project.next_steps.links.set_up_ci
- </ForwardRef(Link)>,
- }
- }
- />
-</DismissableAlert>
-`;
-
-exports[`should render correctly: show prompt to configure PR decoration, project admin 1`] = `
-<DismissableAlert
- alertKey="config_ci_pr_deco.my-project"
- variant="info"
->
- <FormattedMessage
- defaultMessage="overview.project.next_steps.set_up_pr_deco.admin"
- id="overview.project.next_steps.set_up_pr_deco.admin"
- values={
- {
- "link_project_settings": <ForwardRef(Link)
- to={
- {
- "pathname": "/project/settings",
- "search": "?id=my-project&category=pull_request_decoration_binding",
- }
- }
- >
- overview.project.next_steps.links.project_settings
- </ForwardRef(Link)>,
- }
- }
- />
-</DismissableAlert>
-`;
-
-exports[`should render correctly: show prompt to configure PR decoration, regular user 1`] = `
-<DismissableAlert
- alertKey="config_ci_pr_deco.my-project"
- variant="info"
->
- overview.project.next_steps.set_up_pr_deco
-</DismissableAlert>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders correctly for applications 1`] = `
-<Memo(ApplicationLeakPeriodInfo)
- leakPeriod={
- {
- "date": "2017-10-01",
- "project": "foo",
- "projectName": "Foo",
- }
- }
-/>
-`;
-
-exports[`renders correctly for projects 1`] = `
-<Memo(injectIntl(ProjectLeakPeriodInfo))
- leakPeriod={
- {
- "date": "2019-04-23T02:12:32+0100",
- "index": 0,
- "mode": "previous_version",
- }
- }
-/>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly for applications: default 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="new"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-new"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-new"
- role="tabpanel"
- >
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="BUG"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="VULNERABILITY"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="SECURITY_HOTSPOT"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="CODE_SMELL"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- />
- <div
- className="display-flex-row overview-measures-row"
- >
- <div
- className="overview-panel-huge-padded flex-1 bordered-right display-flex-center"
- data-test="overview__measures-coverage"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={true}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-huge-padded flex-1 display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={true}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- useDiffMetric={true}
- />
- </div>
- </div>
- </div>
-</div>
-`;
-
-exports[`should render correctly for applications: overall 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="overall"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-overall"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-overall"
- role="tabpanel"
- >
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="BUG"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="VULNERABILITY"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="SECURITY_HOTSPOT"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="CODE_SMELL"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- />
- <div
- className="display-flex-row overview-measures-row"
- >
- <div
- className="overview-panel-huge-padded flex-1 bordered-right display-flex-center"
- data-test="overview__measures-coverage"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={false}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- useDiffMetric={false}
- />
- <div
- className="huge-spacer-left"
- >
- <DrilldownMeasureValue
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- metric="tests"
- />
- </div>
- </div>
- <div
- className="overview-panel-huge-padded flex-1 display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={false}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- useDiffMetric={false}
- />
- <div
- className="huge-spacer-left"
- >
- <DrilldownMeasureValue
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- metric="duplicated_blocks"
- />
- </div>
- </div>
- </div>
- </div>
-</div>
-`;
-
-exports[`should render correctly for projects: default 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="new"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-new"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-new"
- role="tabpanel"
- >
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="BUG"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="VULNERABILITY"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="SECURITY_HOTSPOT"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="CODE_SMELL"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- />
- <div
- className="display-flex-row overview-measures-row"
- >
- <div
- className="overview-panel-huge-padded flex-1 bordered-right display-flex-center"
- data-test="overview__measures-coverage"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={true}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-huge-padded flex-1 display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={true}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- useDiffMetric={true}
- />
- </div>
- </div>
- </div>
-</div>
-`;
-
-exports[`should render correctly for projects: overall 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="overall"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-overall"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-overall"
- role="tabpanel"
- >
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="BUG"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="VULNERABILITY"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="SECURITY_HOTSPOT"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="CODE_SMELL"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- />
- <div
- className="display-flex-row overview-measures-row"
- >
- <div
- className="overview-panel-huge-padded flex-1 bordered-right display-flex-center"
- data-test="overview__measures-coverage"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={false}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- useDiffMetric={false}
- />
- <div
- className="huge-spacer-left"
- >
- <DrilldownMeasureValue
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- metric="tests"
- />
- </div>
- </div>
- <div
- className="overview-panel-huge-padded flex-1 display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={false}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- useDiffMetric={false}
- />
- <div
- className="huge-spacer-left"
- >
- <DrilldownMeasureValue
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- metric="duplicated_blocks"
- />
- </div>
- </div>
- </div>
- </div>
-</div>
-`;
-
-exports[`should render correctly if branch is misconfigured: hide settings 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": false,
- "name": "own-reference",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="new"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- <LeakPeriodInfo
- leakPeriod={
- {
- "date": undefined,
- "index": 0,
- "mode": "REFERENCE_BRANCH",
- "parameter": "own-reference",
- }
- }
- />
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-new"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-new"
- role="tabpanel"
- >
- <MeasuresPanelNoNewCode
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": false,
- "name": "own-reference",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- period={
- {
- "date": undefined,
- "index": 0,
- "mode": "REFERENCE_BRANCH",
- "parameter": "own-reference",
- }
- }
- />
- </div>
-</div>
-`;
-
-exports[`should render correctly if branch is misconfigured: show settings 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": false,
- "name": "own-reference",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "configuration": {
- "showSettings": true,
- },
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="new"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- <LeakPeriodInfo
- leakPeriod={
- {
- "date": undefined,
- "index": 0,
- "mode": "REFERENCE_BRANCH",
- "parameter": "own-reference",
- }
- }
- />
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-new"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-new"
- role="tabpanel"
- >
- <MeasuresPanelNoNewCode
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": false,
- "name": "own-reference",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "configuration": {
- "showSettings": true,
- },
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- period={
- {
- "date": undefined,
- "index": 0,
- "mode": "REFERENCE_BRANCH",
- "parameter": "own-reference",
- }
- }
- />
- </div>
-</div>
-`;
-
-exports[`should render correctly if the data is still loading 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <div
- className="overview-panel-content overview-panel-big-padded"
- >
- <DeferredSpinner
- loading={true}
- />
- </div>
-</div>
-`;
-
-exports[`should render correctly if there is no coverage 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="new"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-new"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-new"
- role="tabpanel"
- >
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="BUG"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="VULNERABILITY"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="SECURITY_HOTSPOT"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="CODE_SMELL"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- />
- <div
- className="display-flex-row overview-measures-row"
- >
- <div
- className="overview-panel-huge-padded flex-1 display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={true}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- useDiffMetric={true}
- />
- </div>
- </div>
- </div>
-</div>
-`;
-
-exports[`should render correctly if there is no new code measures 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="new"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-new"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-new"
- role="tabpanel"
- >
- <MeasuresPanelNoNewCode
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
-</div>
-`;
-
-exports[`should render correctly when code scope is new code 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="new"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-new"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-new"
- role="tabpanel"
- >
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="BUG"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="VULNERABILITY"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="SECURITY_HOTSPOT"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={true}
- key="CODE_SMELL"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- />
- <div
- className="display-flex-row overview-measures-row"
- >
- <div
- className="overview-panel-huge-padded flex-1 bordered-right display-flex-center"
- data-test="overview__measures-coverage"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={true}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-huge-padded flex-1 display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={true}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- useDiffMetric={true}
- />
- </div>
- </div>
- </div>
-</div>
-`;
-
-exports[`should render correctly when code scope is overall code 1`] = `
-<div
- className="overview-panel"
- data-test="overview__measures-panel"
->
- <div
- className="display-flex-space-between display-flex-start"
- >
- <h2
- className="overview-panel-title"
- >
- overview.measures
- </h2>
- <withCurrentUserContext(withAppStateContext(ComponentReportActions))
- branch={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <BoxedTabs
- onSelect={[Function]}
- selected="overall"
- tabs={
- [
- {
- "key": "new",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- >
- overview.new_code
- </span>
- </div>,
- },
- {
- "key": "overall",
- "label": <div
- className="text-left overview-measures-tab"
- >
- <span
- className="text-bold"
- style={
- {
- "position": "absolute",
- "top": 16,
- }
- }
- >
- overview.overall_code
- </span>
- </div>,
- },
- ]
- }
- />
- <div
- aria-labelledby="tab-overall"
- className="overview-panel-content flex-1 bordered"
- id="tabpanel-overall"
- role="tabpanel"
- >
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="BUG"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="VULNERABILITY"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="SECURITY_HOTSPOT"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- />
- <MeasuresPanelIssueMeasureRow
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- isNewCodeTab={false}
- key="CODE_SMELL"
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- />
- <div
- className="display-flex-row overview-measures-row"
- >
- <div
- className="overview-panel-huge-padded flex-1 bordered-right display-flex-center"
- data-test="overview__measures-coverage"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={false}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- useDiffMetric={false}
- />
- <div
- className="huge-spacer-left"
- >
- <DrilldownMeasureValue
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- metric="tests"
- />
- </div>
- </div>
- <div
- className="overview-panel-huge-padded flex-1 display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- centered={false}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- useDiffMetric={false}
- />
- <div
- className="huge-spacer-left"
- >
- <DrilldownMeasureValue
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "excludedFromPurge": true,
- "isMain": true,
- "name": "master",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_coverage",
- "key": "new_coverage",
- "name": "new_coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "bugs",
- "key": "bugs",
- "name": "bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- metric="duplicated_blocks"
- />
- </div>
- </div>
- </div>
- </div>
-</div>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render a more precise date 1`] = `
-<Fragment>
- <div
- className="note spacer-top text-ellipsis"
- title="overview.period.previous_version_only_date"
- >
- overview.period.previous_version_only_date
- </div>
- <DateFromNow
- date={2018-08-16T22:00:00.000Z}
- >
- <Component />
- </DateFromNow>
-</Fragment>
-`;
-
-exports[`should render correctly for "REFERENCE_BRANCH" 1`] = `
-<div
- className="note spacer-top"
->
- overview.period.reference_branch.master
-
-</div>
-`;
-
-exports[`should render correctly for "manual_baseline" 1`] = `
-<Fragment>
- <div
- className="note spacer-top text-ellipsis"
- title="overview.period.manual_baseline.formattedTime.2019-04-23T02:12:32+0100"
- >
- overview.period.manual_baseline.formattedTime.2019-04-23T02:12:32+0100
- </div>
- <DateFromNow
- date={2019-04-23T01:12:32.000Z}
- >
- <Component />
- </DateFromNow>
-</Fragment>
-`;
-
-exports[`should render correctly for "manual_baseline" 2`] = `
-<Fragment>
- <div
- className="note spacer-top text-ellipsis"
- title="overview.period.manual_baseline.1.1.2"
- >
- overview.period.manual_baseline.1.1.2
- </div>
- <DateFromNow
- date={2019-04-23T01:12:32.000Z}
- >
- <Component />
- </DateFromNow>
-</Fragment>
-`;
-
-exports[`should render correctly for "previous_analysis" 1`] = `
-<Fragment>
- <div
- className="note spacer-top text-ellipsis"
- title="overview.period.previous_analysis."
- >
- overview.period.previous_analysis.
- </div>
- <DateFromNow
- date={2019-04-23T01:12:32.000Z}
- >
- <Component />
- </DateFromNow>
-</Fragment>
-`;
-
-exports[`should render correctly for "previous_version" 1`] = `
-<Fragment>
- <div
- className="note spacer-top text-ellipsis"
- title="overview.period.previous_version_only_date"
- >
- overview.period.previous_version_only_date
- </div>
- <DateFromNow
- date={2019-04-23T01:12:32.000Z}
- >
- <Component />
- </DateFromNow>
-</Fragment>
-`;
-
-exports[`should render correctly for 10 days 1`] = `
-<div
- className="note spacer-top"
->
- overview.period.days.10
-
-</div>
-`;
-
-exports[`should render correctly for a specific date 1`] = `
-<Fragment>
- <div
- className="note spacer-top text-ellipsis"
- title="overview.period.date.formatted.2013-01-01"
- >
- overview.period.date.formatted.2013-01-01
- </div>
- <DateFromNow
- date={2019-04-23T01:12:32.000Z}
- >
- <Component />
- </DateFromNow>
-</Fragment>
-`;
-
-exports[`should render correctly for a specific version 1`] = `
-<Fragment>
- <div
- className="note spacer-top text-ellipsis"
- title="overview.period.version.0.1"
- >
- overview.period.version.0.1
- </div>
- <DateFromNow
- date={2019-04-23T01:12:32.000Z}
- >
- <Component />
- </DateFromNow>
-</Fragment>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly for applications 1`] = `
-<div
- className="overview-panel"
- data-test="overview__quality-gate-panel"
->
- <div
- className="display-flex-center spacer-bottom"
- >
- <h2
- className="overview-panel-title null-spacer-bottom"
- >
- overview.quality_gate
-
- </h2>
- <HelpTooltip
- className="little-spacer-left"
- overlay={
- <div
- className="big-padded-top big-padded-bottom"
- >
- overview.quality_gate.help
- </div>
- }
- />
- </div>
- <div>
- <div
- className="overview-quality-gate-badge-large failed"
- >
- <div
- className="big-spacer-bottom huge h3"
- >
- metric.level.ERROR
- </div>
- <span
- className="small"
- >
- overview.X_conditions_failed.3
- </span>
- </div>
- <div
- data-test="overview__quality-gate-conditions"
- >
- <Memo(QualityGatePanelSection)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- key="foo"
- qgStatus={
- {
- "caycStatus": "compliant",
- "failedConditions": [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- ],
- "ignoredConditions": false,
- "key": "foo",
- "name": "Foo",
- "status": "ERROR",
- }
- }
- />
- <Memo(QualityGatePanelSection)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- key="foo"
- qgStatus={
- {
- "caycStatus": "compliant",
- "failedConditions": [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "new_code_smells",
- "op": "GT",
- },
- ],
- "ignoredConditions": false,
- "key": "foo",
- "name": "Foo",
- "status": "ERROR",
- }
- }
- />
- </div>
- </div>
- <withCurrentUserContext(SonarLintPromotion)
- qgConditions={
- [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "new_code_smells",
- "op": "GT",
- },
- ]
- }
- />
-</div>
-`;
-
-exports[`should render correctly for applications 2`] = `
-<div
- className="overview-panel"
- data-test="overview__quality-gate-panel"
->
- <div
- className="display-flex-center spacer-bottom"
- >
- <h2
- className="overview-panel-title null-spacer-bottom"
- >
- overview.quality_gate
-
- </h2>
- <HelpTooltip
- className="little-spacer-left"
- overlay={
- <div
- className="big-padded-top big-padded-bottom"
- >
- overview.quality_gate.help
- </div>
- }
- />
- </div>
- <div>
- <div
- className="overview-quality-gate-badge-large failed"
- >
- <div
- className="big-spacer-bottom huge h3"
- >
- metric.level.ERROR
- </div>
- <span
- className="small"
- >
- overview.X_conditions_failed.1
- </span>
- </div>
- <div
- data-test="overview__quality-gate-conditions"
- >
- <Memo(QualityGatePanelSection)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- key="foo"
- qgStatus={
- {
- "caycStatus": "compliant",
- "failedConditions": [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- ],
- "ignoredConditions": false,
- "key": "foo",
- "name": "Foo",
- "status": "ERROR",
- }
- }
- />
- <Memo(QualityGatePanelSection)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "APP",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- key="foo"
- qgStatus={
- {
- "caycStatus": "compliant",
- "failedConditions": [],
- "ignoredConditions": false,
- "key": "foo",
- "name": "Foo",
- "status": "OK",
- }
- }
- />
- </div>
- </div>
- <withCurrentUserContext(SonarLintPromotion)
- qgConditions={
- [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- ]
- }
- />
-</div>
-`;
-
-exports[`should render correctly for projects 1`] = `
-<div
- className="overview-panel"
- data-test="overview__quality-gate-panel"
->
- <div
- className="display-flex-center spacer-bottom"
- >
- <h2
- className="overview-panel-title null-spacer-bottom"
- >
- overview.quality_gate
-
- </h2>
- <HelpTooltip
- className="little-spacer-left"
- overlay={
- <div
- className="big-padded-top big-padded-bottom"
- >
- overview.quality_gate.help
- </div>
- }
- />
- </div>
- <div>
- <div
- className="overview-quality-gate-badge-large failed"
- >
- <div
- className="big-spacer-bottom huge h3"
- >
- metric.level.ERROR
- </div>
- <span
- className="small"
- >
- overview.X_conditions_failed.1
- </span>
- </div>
- <div
- data-test="overview__quality-gate-conditions"
- >
- <Memo(QualityGatePanelSection)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- key="foo"
- qgStatus={
- {
- "caycStatus": "compliant",
- "failedConditions": [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- ],
- "ignoredConditions": false,
- "key": "foo",
- "name": "Foo",
- "status": "ERROR",
- }
- }
- />
- </div>
- </div>
- <withCurrentUserContext(SonarLintPromotion)
- qgConditions={
- [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- ]
- }
- />
-</div>
-`;
-
-exports[`should render correctly for projects 2`] = `
-<div
- className="overview-panel"
- data-test="overview__quality-gate-panel"
->
- <div
- className="display-flex-center spacer-bottom"
- >
- <h2
- className="overview-panel-title null-spacer-bottom"
- >
- overview.quality_gate
-
- </h2>
- <HelpTooltip
- className="little-spacer-left"
- overlay={
- <div
- className="big-padded-top big-padded-bottom"
- >
- overview.quality_gate.help
- </div>
- }
- />
- </div>
- <div>
- <div
- className="overview-quality-gate-badge-large success"
- >
- <div
- className="big-spacer-bottom huge h3"
- >
- metric.level.OK
- </div>
- <span
- className="small"
- >
- overview.quality_gate_all_conditions_passed
- </span>
- </div>
- </div>
- <withCurrentUserContext(SonarLintPromotion)
- qgConditions={[]}
- />
-</div>
-`;
-
-exports[`should render correctly for projects 3`] = `
-<div
- className="overview-panel"
- data-test="overview__quality-gate-panel"
->
- <div
- className="display-flex-center spacer-bottom"
- >
- <h2
- className="overview-panel-title null-spacer-bottom"
- >
- overview.quality_gate
-
- </h2>
- <HelpTooltip
- className="little-spacer-left"
- overlay={
- <div
- className="big-padded-top big-padded-bottom"
- >
- overview.quality_gate.help
- </div>
- }
- />
- </div>
- <Alert
- className="big-spacer-bottom"
- display="inline"
- variant="info"
- >
- <span
- className="text-middle"
- >
- overview.quality_gate.ignored_conditions
- </span>
- <HelpTooltip
- className="spacer-left"
- overlay="overview.quality_gate.ignored_conditions.tooltip"
- />
- </Alert>
- <div>
- <div
- className="overview-quality-gate-badge-large failed"
- >
- <div
- className="big-spacer-bottom huge h3"
- >
- metric.level.ERROR
- </div>
- <span
- className="small"
- >
- overview.X_conditions_failed.1
- </span>
- </div>
- <div
- data-test="overview__quality-gate-conditions"
- >
- <Memo(QualityGatePanelSection)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- key="foo"
- qgStatus={
- {
- "caycStatus": "compliant",
- "failedConditions": [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- ],
- "ignoredConditions": true,
- "key": "foo",
- "name": "Foo",
- "status": "ERROR",
- }
- }
- />
- </div>
- </div>
- <withCurrentUserContext(SonarLintPromotion)
- qgConditions={
- [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "foo",
- "op": "GT",
- },
- ]
- }
- />
-</div>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly 1`] = `
-<div
- className="overview-quality-gate-conditions"
->
- <div
- className="big-padded bordered-bottom overview-quality-gate-conditions-list"
- >
- <CleanAsYouCodeWarning
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- />
- </div>
- <div
- className="big-padded overview-quality-gate-conditions-section-title h4"
- >
- quality_gates.conditions.new_code_x.1
- </div>
- <Memo(QualityGateConditions)
- component={
- {
- "caycStatus": "non-compliant",
- "failedConditions": [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "bugs",
- "op": "GT",
- },
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "new_bugs",
- "op": "GT",
- },
- ],
- "ignoredConditions": false,
- "key": "foo",
- "name": "Foo",
- "status": "ERROR",
- }
- }
- failedConditions={
- [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "new_bugs",
- "op": "GT",
- },
- ]
- }
- />
- <div
- className="big-padded overview-quality-gate-conditions-section-title h4"
- >
- quality_gates.conditions.overall_code_x.1
- </div>
- <Memo(QualityGateConditions)
- component={
- {
- "caycStatus": "non-compliant",
- "failedConditions": [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "bugs",
- "op": "GT",
- },
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "new_bugs",
- "op": "GT",
- },
- ],
- "ignoredConditions": false,
- "key": "foo",
- "name": "Foo",
- "status": "ERROR",
- }
- }
- failedConditions={
- [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "bugs",
- "op": "GT",
- },
- ]
- }
- />
-</div>
-`;
-
-exports[`should render correctly 2`] = `
-<div
- className="overview-quality-gate-conditions"
->
- <ButtonPlain
- aria-expanded={true}
- aria-label="overview.quality_gate.hide_project_conditions_x.Foo"
- className="width-100 text-left"
- onClick={[Function]}
- >
- <div
- className="display-flex-center"
- >
- <div
- className="overview-quality-gate-conditions-project-name text-ellipsis h3"
- title="Foo"
- >
- <ChevronDownIcon />
- <span
- className="spacer-left"
- >
- Foo
- </span>
- </div>
- </div>
- </ButtonPlain>
- <div
- className="big-padded overview-quality-gate-conditions-section-title h4"
- >
- quality_gates.conditions.new_code_x.1
- </div>
- <Memo(QualityGateConditions)
- component={
- {
- "caycStatus": "non-compliant",
- "failedConditions": [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "bugs",
- "op": "GT",
- },
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "new_bugs",
- "op": "GT",
- },
- ],
- "ignoredConditions": false,
- "key": "foo",
- "name": "Foo",
- "status": "ERROR",
- }
- }
- failedConditions={
- [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "new_bugs",
- "op": "GT",
- },
- ]
- }
- />
- <div
- className="big-padded overview-quality-gate-conditions-section-title h4"
- >
- quality_gates.conditions.overall_code_x.1
- </div>
- <Memo(QualityGateConditions)
- component={
- {
- "caycStatus": "non-compliant",
- "failedConditions": [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "bugs",
- "op": "GT",
- },
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "new_bugs",
- "op": "GT",
- },
- ],
- "ignoredConditions": false,
- "key": "foo",
- "name": "Foo",
- "status": "ERROR",
- }
- }
- failedConditions={
- [
- {
- "actual": "10",
- "error": "0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "leak": "1",
- "metric": {
- "id": "coverage",
- "key": "coverage",
- "name": "coverage",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "bugs",
- "op": "GT",
- },
- ]
- }
- />
-</div>
-`;
import PullRequestOverview from '../pullRequests/PullRequestOverview';
import EmptyOverview from './EmptyOverview';
-interface Props extends WithAvailableFeaturesProps {
+interface AppProps extends WithAvailableFeaturesProps {
branchLike?: BranchLike;
branchLikes: BranchLike[];
component: Component;
projectBinding?: ProjectAlmBindingResponse;
}
-export class App extends React.PureComponent<Props> {
- isPortfolio = () => {
- return isPortfolioLike(this.props.component.qualifier);
- };
+export function App(props: AppProps) {
+ const { branchLike, branchLikes, component, projectBinding, isPending, isInProgress } = props;
+ const branchSupportEnabled = props.hasFeature(Feature.BranchSupport);
- render() {
- const { branchLike, branchLikes, component, projectBinding } = this.props;
- const branchSupportEnabled = this.props.hasFeature(Feature.BranchSupport);
-
- if (this.isPortfolio()) {
- return null;
- }
+ if (isPortfolioLike(component.qualifier)) {
+ return null;
+ }
- return isPullRequest(branchLike) ? (
- <main>
- <Suggestions suggestions="pull_requests" />
- <PullRequestOverview branchLike={branchLike} component={component} />
- </main>
- ) : (
- <main>
- <Suggestions suggestions="overview" />
+ return isPullRequest(branchLike) ? (
+ <main>
+ <Suggestions suggestions="pull_requests" />
+ <PullRequestOverview branchLike={branchLike} component={component} />
+ </main>
+ ) : (
+ <main>
+ <Suggestions suggestions="overview" />
- {!component.analysisDate && (
- <EmptyOverview
- branchLike={branchLike}
- branchLikes={branchLikes}
- component={component}
- hasAnalyses={this.props.isPending || this.props.isInProgress}
- projectBinding={projectBinding}
- />
- )}
+ {!component.analysisDate && (
+ <EmptyOverview
+ branchLike={branchLike}
+ branchLikes={branchLikes}
+ component={component}
+ hasAnalyses={isPending || isInProgress}
+ projectBinding={projectBinding}
+ />
+ )}
- {component.analysisDate && (
- <BranchOverview
- branch={branchLike}
- branchesEnabled={branchSupportEnabled}
- component={component}
- projectBinding={projectBinding}
- />
- )}
- </main>
- );
- }
+ {component.analysisDate && (
+ <BranchOverview
+ branch={branchLike}
+ branchesEnabled={branchSupportEnabled}
+ component={component}
+ projectBinding={projectBinding}
+ />
+ )}
+ </main>
+ );
}
export default withComponentContext(withAvailableFeatures(App));
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { FormattedMessage } from 'react-intl';
import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext';
import TutorialSelection from '../../../components/tutorials/TutorialSelection';
import { Alert } from '../../../components/ui/Alert';
import { getBranchLikeDisplayName, isBranch, isMainBranch } from '../../../helpers/branch-like';
-import { translate } from '../../../helpers/l10n';
+import { translate, translateWithParameters } from '../../../helpers/l10n';
import { ProjectAlmBindingResponse } from '../../../types/alm-settings';
import { BranchLike } from '../../../types/branch-like';
import { ComponentQualifier } from '../../../types/component';
if (component.qualifier === ComponentQualifier.Application) {
return (
<div className="page page-limited">
- <Alert variant="warning">{translate('provisioning.no_analysis.application')}</Alert>
+ <Alert variant="warning" aria-label={translate('provisioning.no_analysis.application')}>
+ {translate('provisioning.no_analysis.application')}
+ </Alert>
</div>
);
} else if (!isBranch(branchLike)) {
let warning;
if (isLoggedIn(currentUser) && showWarning && hasBadBranchConfig) {
- warning = (
- <FormattedMessage
- defaultMessage={translate('provisioning.no_analysis_on_main_branch.bad_configuration')}
- id="provisioning.no_analysis_on_main_branch.bad_configuration"
- values={{
- branchName: getBranchLikeDisplayName(branchLike),
- branchType: translate('branches.main_branch'),
- }}
- />
+ warning = translateWithParameters(
+ 'provisioning.no_analysis_on_main_branch.bad_configuration',
+ getBranchLikeDisplayName(branchLike),
+ translate('branches.main_branch')
);
} else {
- warning = (
- <FormattedMessage
- defaultMessage={translate('provisioning.no_analysis_on_main_branch')}
- id="provisioning.no_analysis_on_main_branch"
- values={{
- branchName: getBranchLikeDisplayName(branchLike),
- }}
- />
+ warning = translateWithParameters(
+ 'provisioning.no_analysis_on_main_branch',
+ getBranchLikeDisplayName(branchLike)
);
}
<div className="page page-limited">
{isLoggedIn(currentUser) ? (
<>
- {showWarning && <Alert variant="warning">{warning}</Alert>}
+ {showWarning && (
+ <Alert variant="warning" aria-label={warning}>
+ {warning}
+ </Alert>
+ )}
{showTutorial && (
<TutorialSelection
component={component}
)}
</>
) : (
- <Alert variant="warning">{warning}</Alert>
+ <Alert variant="warning" aria-label={warning}>
+ {warning}
+ </Alert>
)}
</div>
);
* 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 { screen } from '@testing-library/react';
import * as React from 'react';
-import { mockPullRequest } from '../../../../helpers/mocks/branch-like';
-import BranchOverview from '../../branches/BranchOverview';
-import PullRequestOverview from '../../pullRequests/PullRequestOverview';
+import CurrentUserContextProvider from '../../../../app/components/current-user/CurrentUserContextProvider';
+import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like';
+import { mockComponent } from '../../../../helpers/mocks/component';
+import { mockCurrentUser } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { ComponentQualifier } from '../../../../types/component';
import { App } from '../App';
-const component = {
- key: 'foo',
- analysisDate: '2016-01-01',
- breadcrumbs: [],
- name: 'Foo',
- qualifier: 'TRK',
- version: '0.0.1',
-};
-
-it('should render BranchOverview', () => {
- expect(getWrapper().find(BranchOverview).exists()).toBe(true);
- expect(getWrapper({ branchLike: mockPullRequest() }).find(PullRequestOverview).exists()).toBe(
- true
- );
+it('should render Empty Overview for Application with no analysis', async () => {
+ renderApp({ component: mockComponent({ qualifier: ComponentQualifier.Application }) });
+
+ expect(
+ await screen.findByRole('alert', { name: 'provisioning.no_analysis.application' })
+ ).toBeInTheDocument();
+});
+
+it('should render Empty Overview on main branch with no analysis', async () => {
+ renderApp({}, mockCurrentUser());
+
+ expect(
+ await screen.findByRole('alert', { name: 'provisioning.no_analysis_on_main_branch.master' })
+ ).toBeInTheDocument();
+});
+
+it('should render Empty Overview on main branch with multiple branches with bad configuration', async () => {
+ renderApp({ branchLikes: [mockBranch(), mockBranch()] });
+
+ expect(
+ await screen.findByRole('alert', {
+ name: 'provisioning.no_analysis_on_main_branch.bad_configuration.master.branches.main_branch',
+ })
+ ).toBeInTheDocument();
+});
+
+it('should not render for portfolios and subportfolios', () => {
+ const rtl = renderApp({
+ component: mockComponent({ qualifier: ComponentQualifier.Portfolio }),
+ });
+ expect(rtl.container).toBeEmptyDOMElement();
+
+ rtl.unmount();
+
+ renderApp({
+ component: mockComponent({ qualifier: ComponentQualifier.Portfolio }),
+ });
+ expect(rtl.container).toBeEmptyDOMElement();
});
-function getWrapper(props = {}) {
- return shallow(
- <App
- hasFeature={jest.fn().mockReturnValue(false)}
- branchLikes={[]}
- component={component}
- {...props}
- />
+function renderApp(props = {}, userProps = {}) {
+ return renderComponent(
+ <CurrentUserContextProvider currentUser={mockCurrentUser({ isLoggedIn: true, ...userProps })}>
+ <App
+ hasFeature={jest.fn().mockReturnValue(false)}
+ branchLikes={[]}
+ branchLike={mockMainBranch()}
+ component={mockComponent()}
+ {...props}
+ />
+ </CurrentUserContextProvider>
);
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { 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 } from '../../../../helpers/mocks/component';
-import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks';
-import { ComponentQualifier } from '../../../../types/component';
-import { EmptyOverview, EmptyOverviewProps } from '../EmptyOverview';
-
-it('renders correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(shallowRender({ hasAnalyses: true })).toMatchSnapshot();
- expect(shallowRender({ currentUser: mockCurrentUser() })).toMatchSnapshot();
- expect(shallowRender({ projectBinding: mockProjectGithubBindingResponse() })).toMatchSnapshot();
-});
-
-it('should render another message when there are branches', () => {
- expect(shallowRender({ branchLikes: [mockMainBranch(), mockBranch()] })).toMatchSnapshot();
- expect(
- shallowRender({
- branchLikes: [mockMainBranch(), mockBranch(), mockBranch({ name: 'branch-7.8' })],
- })
- ).toMatchSnapshot();
-});
-
-it('should not render warning message for pull requests', () => {
- expect(shallowRender({ branchLike: mockPullRequest() }).type()).toBeNull();
-});
-
-it('should not render the tutorial for applications', () => {
- expect(
- shallowRender({ component: mockComponent({ qualifier: ComponentQualifier.Application }) })
- ).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<EmptyOverviewProps> = {}) {
- return shallow<EmptyOverviewProps>(
- <EmptyOverview
- branchLike={mockMainBranch()}
- branchLikes={[mockMainBranch()]}
- component={mockComponent({ version: '0.0.1' })}
- currentUser={mockLoggedInUser()}
- {...props}
- />
- );
-}
* 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 { screen } from '@testing-library/react';
import * as React from 'react';
import { mockPullRequest } from '../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../helpers/mocks/component';
import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { IssueType } from '../../../../types/issues';
import { MetricKey } from '../../../../types/metrics';
import { IssueLabel, IssueLabelProps } from '../IssueLabel';
-it('should render correctly for bugs', () => {
+it('should render correctly for bugs', async () => {
const measures = [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) }),
];
- expect(shallowRender({ measures })).toMatchSnapshot();
- expect(shallowRender({ measures, useDiffMetric: true })).toMatchSnapshot();
-});
-it('should render correctly for code smells', () => {
- const type = IssueType.CodeSmell;
- const measures = [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.code_smells }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_code_smells }) }),
- ];
- expect(shallowRender({ measures, type })).toMatchSnapshot();
- expect(shallowRender({ measures, type, useDiffMetric: true })).toMatchSnapshot();
-});
+ const rtl = renderIssueLabel({ measures });
+ expect(
+ await screen.findByRole('link', {
+ name: 'overview.see_list_of_x_y_issues.1.0.metric.bugs.name',
+ })
+ ).toBeInTheDocument();
-it('should render correctly for vulnerabilities', () => {
- const type = IssueType.Vulnerability;
- const measures = [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.vulnerabilities }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_vulnerabilities }) }),
- ];
- expect(shallowRender({ measures, type })).toMatchSnapshot();
- expect(shallowRender({ measures, type, useDiffMetric: true })).toMatchSnapshot();
+ rtl.unmount();
+
+ renderIssueLabel({ measures, useDiffMetric: true });
+
+ expect(
+ await screen.findByRole('link', {
+ name: 'overview.see_list_of_x_y_issues.1.0.metric.new_bugs.name',
+ })
+ ).toBeInTheDocument();
});
-it('should render correctly for hotspots', () => {
+it('should render correctly for hotspots with tooltip', async () => {
const helpTooltip = 'tooltip text';
const type = IssueType.SecurityHotspot;
const measures = [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.security_hotspots }) }),
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_security_hotspots }) }),
];
+
+ renderIssueLabel({
+ helpTooltip,
+ measures,
+ type,
+ });
+
expect(
- shallowRender({
- helpTooltip,
- measures,
- type,
- })
- ).toMatchSnapshot();
- expect(
- shallowRender({
- helpTooltip,
- measures,
- type,
- useDiffMetric: true,
+ await screen.findByRole('link', {
+ name: 'overview.see_list_of_x_y_issues.1.0.metric.security_hotspots.name',
})
- ).toMatchSnapshot();
-});
+ ).toBeInTheDocument();
-it('should render correctly if no values are present', () => {
- expect(shallowRender()).toMatchSnapshot();
+ expect(await screen.findByText('tooltip text')).toBeInTheDocument();
});
-function shallowRender(props: Partial<IssueLabelProps> = {}) {
- return shallow(
+function renderIssueLabel(props: Partial<IssueLabelProps> = {}) {
+ return renderComponent(
<IssueLabel
branchLike={mockPullRequest()}
component={mockComponent()}
* 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 { screen } from '@testing-library/react';
import * as React from 'react';
import { mockPullRequest } from '../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../helpers/mocks/component';
import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { IssueType } from '../../../../types/issues';
import { MetricKey } from '../../../../types/metrics';
import { IssueRating, IssueRatingProps } from '../IssueRating';
-it('should render correctly for bugs', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(shallowRender({ useDiffMetric: true })).toMatchSnapshot();
-});
-
-it('should render correctly for code smells', () => {
- expect(shallowRender({ type: IssueType.CodeSmell })).toMatchSnapshot();
- expect(shallowRender({ type: IssueType.CodeSmell, useDiffMetric: true })).toMatchSnapshot();
-});
+it('should render correctly for vulnerabilities', async () => {
+ renderIssueRating({ type: IssueType.Vulnerability });
+ expect(await screen.findByText('metric_domain.Security')).toBeInTheDocument();
-it('should render correctly for vulnerabilities', () => {
- expect(shallowRender({ type: IssueType.Vulnerability })).toMatchSnapshot();
- expect(shallowRender({ type: IssueType.Vulnerability, useDiffMetric: true })).toMatchSnapshot();
+ renderIssueRating({ type: IssueType.Vulnerability, useDiffMetric: true });
+ const labels = await screen.findAllByText('metric_domain.Security');
+ expect(labels).toHaveLength(2);
+ const tooltips = await screen.findAllByText('metric.security_rating.tooltip.A');
+ expect(tooltips).toHaveLength(2);
});
-it('should render correctly if no values are present', () => {
- expect(
- shallowRender({
- measures: [mockMeasureEnhanced({ metric: mockMetric({ key: 'NONE' }) })],
- })
- ).toMatchSnapshot();
+it('should render correctly if no values are present', async () => {
+ renderIssueRating({
+ measures: [mockMeasureEnhanced({ metric: mockMetric({ key: 'NONE' }) })],
+ });
+ expect(await screen.findByText('metric_domain.Reliability')).toBeInTheDocument();
});
-function shallowRender(props: Partial<IssueRatingProps> = {}) {
- return shallow(
+function renderIssueRating(props: Partial<IssueRatingProps> = {}) {
+ return renderComponent(
<IssueRating
branchLike={mockPullRequest()}
component={mockComponent()}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { screen } from '@testing-library/react';
import { differenceInDays } from 'date-fns';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IntlShape } from 'react-intl';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { Period } from '../../../../types/types';
import { LeakPeriodLegend } from '../LeakPeriodLegend';
return { ...actual, differenceInDays: jest.fn().mockReturnValue(10) };
});
-it('10 days', () => {
- expect(getWrapper({ mode: 'days', parameter: '10' })).toMatchSnapshot();
+it('10 days', async () => {
+ renderLeakPeriodLegend({ mode: 'days', parameter: '10' });
+
+ expect(
+ await screen.findByText('overview.new_code_period_x.overview.period.days.10')
+ ).toBeInTheDocument();
});
-it('date', () => {
- expect(getWrapper({ mode: 'date', parameter: '2013-01-01' })).toMatchSnapshot();
+it('date', async () => {
+ renderLeakPeriodLegend({ mode: 'date', parameter: '2013-01-01' });
+
+ expect(
+ await screen.findByText('overview.new_code_period_x.overview.period.date.formatted.2013-01-01')
+ ).toBeInTheDocument();
+ expect(await screen.findByText('overview.started_x.9 years ago')).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_on_x\..*/)).toBeInTheDocument();
});
-it('version', () => {
- expect(findLegend(getWrapper({ mode: 'version', parameter: '0.1' }))).toMatchSnapshot();
+it('version', async () => {
+ renderLeakPeriodLegend({ mode: 'version', parameter: '0.1' });
+
+ expect(
+ await screen.findByText('overview.new_code_period_x.overview.period.version.0.1')
+ ).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_x\..*/)).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_on_x\..*/)).toBeInTheDocument();
});
-it('previous_version', () => {
- expect(findLegend(getWrapper({ mode: 'previous_version' }))).toMatchSnapshot();
+it('previous_version', async () => {
+ renderLeakPeriodLegend({ mode: 'previous_version' });
+
+ expect(
+ await screen.findByText('overview.new_code_period_x.overview.period.previous_version_only_date')
+ ).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_x\..*/)).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_on_x\..*/)).toBeInTheDocument();
});
-it('previous_analysis', () => {
- expect(findLegend(getWrapper({ mode: 'previous_analysis' }))).toMatchSnapshot();
+it('previous_analysis', async () => {
+ renderLeakPeriodLegend({ mode: 'previous_analysis' });
+
+ expect(
+ await screen.findByText('overview.new_code_period_x.overview.period.previous_analysis.')
+ ).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.previous_analysis_x\..*/)).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.previous_analysis_x\..*/)).toBeInTheDocument();
});
-it('manual_baseline', () => {
- expect(findLegend(getWrapper({ mode: 'manual_baseline' }))).toMatchSnapshot();
- expect(findLegend(getWrapper({ mode: 'manual_baseline', parameter: '1.1.2' }))).toMatchSnapshot();
+it('manual_baseline', async () => {
+ const rtl = renderLeakPeriodLegend({ mode: 'manual_baseline' });
+
+ expect(
+ await screen.findByText(
+ /overview\.new_code_period_x\.overview\.period\.manual_baseline\.formattedTime\..*/
+ )
+ ).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_x\..*/)).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_on_x\..*/)).toBeInTheDocument();
+
+ rtl.unmount();
+ renderLeakPeriodLegend({ mode: 'manual_baseline', parameter: '1.1.2' });
+
+ expect(
+ await screen.findByText('overview.new_code_period_x.overview.period.manual_baseline.1.1.2')
+ ).toBeInTheDocument();
+ expect(
+ await screen.findByText('overview.new_code_period_x.overview.period.manual_baseline.1.1.2')
+ ).toBeInTheDocument();
});
-it('should render a more precise date', () => {
+it('should render a more precise date', async () => {
(differenceInDays as jest.Mock<any>).mockReturnValueOnce(0);
+
+ renderLeakPeriodLegend({ date: '2018-08-17T00:00:00+0200', mode: 'previous_version' });
+
expect(
- getWrapper({ date: '2018-08-17T00:00:00+0200', mode: 'previous_version' })
- ).toMatchSnapshot();
+ await screen.findByText('overview.new_code_period_x.overview.period.previous_version_only_date')
+ ).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_x\..*/)).toBeInTheDocument();
+ expect(await screen.findByText(/overview\.started_on_x\..*/)).toBeInTheDocument();
});
-function getWrapper(period: Partial<Period> = {}) {
- return shallow(
+function renderLeakPeriodLegend(period: Partial<Period> = {}) {
+ return renderComponent(
<LeakPeriodLegend
intl={
{
/>
);
}
-
-function findLegend(wrapper: any) {
- return wrapper.find('.overview-legend');
-}
* 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 { screen } from '@testing-library/react';
import * as React from 'react';
import { mockPullRequest } from '../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../helpers/mocks/component';
import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { MetricKey } from '../../../../types/metrics';
import { MeasurementType } from '../../utils';
import MeasurementLabel from '../MeasurementLabel';
-it('should render correctly for coverage', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(
- shallowRender({
- measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.lines_to_cover }) }),
- ],
- })
- ).toMatchSnapshot();
- expect(
- shallowRender({
- measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_lines_to_cover }) }),
- ],
- useDiffMetric: true,
- })
- ).toMatchSnapshot();
+it('should render correctly for coverage', async () => {
+ renderMeasurementLabel();
+ expect(await screen.findByText('metric.coverage.name')).toBeInTheDocument();
+
+ renderMeasurementLabel({
+ measures: [
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.lines_to_cover }) }),
+ ],
+ });
+ expect(await screen.findByText('metric.coverage.name')).toBeInTheDocument();
+ expect(await screen.findByText('overview.coverage_on_X_lines')).toBeInTheDocument();
+
+ renderMeasurementLabel({
+ measures: [
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_coverage }) }),
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_lines_to_cover }) }),
+ ],
+ useDiffMetric: true,
+ });
+ expect(screen.getByRole('link', { name: /.*new_coverage.*/ })).toBeInTheDocument();
+ expect(await screen.findByText('overview.coverage_on_X_lines')).toBeInTheDocument();
+ expect(await screen.findByText('overview.coverage_on_X_new_lines')).toBeInTheDocument();
});
-it('should render correctly for duplications', () => {
+it('should render correctly for duplications', async () => {
+ renderMeasurementLabel({
+ measures: [
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) }),
+ ],
+ type: MeasurementType.Duplication,
+ });
expect(
- shallowRender({
- measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) }),
- ],
- type: MeasurementType.Duplication,
+ screen.getByRole('link', {
+ name: 'overview.see_more_details_on_x_of_y.1.0%.metric.duplicated_lines_density.name',
})
- ).toMatchSnapshot();
- expect(
- shallowRender({
- measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.ncloc }) }),
- ],
- type: MeasurementType.Duplication,
- })
- ).toMatchSnapshot();
+ ).toBeInTheDocument();
+ expect(await screen.findByText('metric.duplicated_lines_density.short_name')).toBeInTheDocument();
+
+ renderMeasurementLabel({
+ measures: [
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) }),
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.ncloc }) }),
+ ],
+ type: MeasurementType.Duplication,
+ });
+ expect(await screen.findByText('metric.duplicated_lines_density.short_name')).toBeInTheDocument();
+ expect(await screen.findByText('overview.duplications_on_X_lines')).toBeInTheDocument();
+
+ renderMeasurementLabel({
+ measures: [
+ mockMeasureEnhanced({
+ metric: mockMetric({ key: MetricKey.new_duplicated_lines_density }),
+ }),
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_lines }) }),
+ ],
+ type: MeasurementType.Duplication,
+ useDiffMetric: true,
+ });
+
expect(
- shallowRender({
- measures: [
- mockMeasureEnhanced({
- metric: mockMetric({ key: MetricKey.new_duplicated_lines_density }),
- }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_lines }) }),
- ],
- type: MeasurementType.Duplication,
- useDiffMetric: true,
+ screen.getByRole('link', {
+ name: 'overview.see_more_details_on_x_of_y.1.0%.metric.new_duplicated_lines_density.name',
})
- ).toMatchSnapshot();
-});
-
-it('should render correctly with no value', () => {
- expect(shallowRender({ measures: [] })).toMatchSnapshot();
+ ).toBeInTheDocument();
+ expect(await screen.findByText('overview.duplications_on_X_new_lines')).toBeInTheDocument();
});
-it('should render correctly when centered', () => {
- expect(shallowRender({ centered: true })).toMatchSnapshot();
+it('should render correctly with no value', async () => {
+ renderMeasurementLabel({ measures: [] });
+ expect(await screen.findByText('metric.coverage.name')).toBeInTheDocument();
});
-function shallowRender(props: Partial<MeasurementLabel['props']> = {}) {
- return shallow(
+function renderMeasurementLabel(props: Partial<MeasurementLabel['props']> = {}) {
+ return renderComponent(
<MeasurementLabel
branchLike={mockPullRequest()}
component={mockComponent()}
* 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 { screen } from '@testing-library/react';
import * as React from 'react';
import { mockBranch } from '../../../../helpers/mocks/branch-like';
import { mockQualityGateStatusConditionEnhanced } from '../../../../helpers/mocks/quality-gates';
import { mockMetric } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { MetricKey } from '../../../../types/metrics';
import { QualityGateStatusConditionEnhanced } from '../../../../types/quality-gates';
import QualityGateCondition from '../QualityGateCondition';
[quickMock(MetricKey.new_maintainability_rating, 'RATING', true)],
[quickMock(MetricKey.security_hotspots_reviewed)],
[quickMock(MetricKey.new_security_hotspots_reviewed, 'RATING', true)],
-])('should render correclty', (condition) => {
- expect(shallowRender({ condition })).toMatchSnapshot();
+])('should render correclty', async (condition) => {
+ renderQualityGateCondition({ condition });
+ expect(
+ await screen.findByText(`metric.${condition.measure.metric.name}.name`)
+ ).toBeInTheDocument();
+
+ expect(
+ await screen.findByText(`quality_gates.operator.${condition.op}`, { exact: false })
+ ).toBeInTheDocument();
+ // if (condition.measure.metric.type === 'RATING') {
+ // expect(await screen.findByText('.rating', { exact: false })).toBeInTheDocument();
+ // }
});
-it('should work with branch', () => {
+it('should work with branch', async () => {
const condition = quickMock(MetricKey.new_maintainability_rating);
- expect(shallowRender({ branchLike: mockBranch(), condition })).toMatchSnapshot();
+ renderQualityGateCondition({ branchLike: mockBranch(), condition });
+
+ expect(await screen.findByText('metric.new_maintainability_rating.name')).toBeInTheDocument();
+ expect(
+ await screen.findByText('quality_gates.operator.GT.rating', { exact: false })
+ ).toBeInTheDocument();
});
-function shallowRender(props: Partial<QualityGateCondition['props']>) {
- return shallow(
+function renderQualityGateCondition(props: Partial<QualityGateCondition['props']>) {
+ return renderComponent(
<QualityGateCondition
component={{ key: 'abcd-key' }}
condition={mockQualityGateStatusConditionEnhanced()}
* 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 { screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import * as React from 'react';
import { mockComponent } from '../../../../helpers/mocks/component';
import { mockQualityGateStatusConditionEnhanced } from '../../../../helpers/mocks/quality-gates';
-import { click } from '../../../../helpers/testUtils';
+import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { QualityGateStatusConditionEnhanced } from '../../../../types/quality-gates';
import { QualityGateConditions, QualityGateConditionsProps } from '../QualityGateConditions';
-it('should render correctly', () => {
- const wrapper = shallowRender();
- expect(wrapper.find('QualityGateCondition').length).toBe(10);
+const ALL_CONDITIONS = 10;
+const HALF_CONDITIONS = 5;
+
+it('should render correctly', async () => {
+ renderQualityGateConditions();
+ expect(await screen.findAllByText(/.*metric..+.name.*/)).toHaveLength(ALL_CONDITIONS);
+
+ expect(await screen.findAllByText('quality_gates.operator', { exact: false })).toHaveLength(
+ ALL_CONDITIONS
+ );
});
-it('should be collapsible', () => {
- const wrapper = shallowRender({ collapsible: true });
- expect(wrapper.find('QualityGateCondition').length).toBe(5);
- click(wrapper.find('ButtonLink'));
- expect(wrapper.find('QualityGateCondition').length).toBe(10);
+it('should be collapsible', async () => {
+ renderQualityGateConditions({ collapsible: true });
+ const user = userEvent.setup();
+
+ expect(await screen.findAllByText(/.*metric..+.name.*/)).toHaveLength(HALF_CONDITIONS);
+ expect(await screen.findAllByText('quality_gates.operator', { exact: false })).toHaveLength(
+ HALF_CONDITIONS
+ );
+
+ await user.click(screen.getByRole('button', { name: 'overview.X_more_failed_conditions.5' }));
+
+ expect(await screen.findAllByText(/.*metric..+.name.*/)).toHaveLength(ALL_CONDITIONS);
+ expect(await screen.findAllByText('quality_gates.operator', { exact: false })).toHaveLength(
+ ALL_CONDITIONS
+ );
});
-function shallowRender(props: Partial<QualityGateConditionsProps> = {}) {
+function renderQualityGateConditions(props: Partial<QualityGateConditionsProps> = {}) {
const conditions: QualityGateStatusConditionEnhanced[] = [];
- for (let i = 10; i > 0; --i) {
- conditions.push(mockQualityGateStatusConditionEnhanced());
+ for (let i = ALL_CONDITIONS; i > 0; --i) {
+ conditions.push(
+ mockQualityGateStatusConditionEnhanced({
+ measure: mockMeasureEnhanced({ metric: mockMetric({ key: i.toString() }) }),
+ })
+ );
}
- return shallow(
+ return renderComponent(
<QualityGateConditions component={mockComponent()} failedConditions={conditions} {...props} />
);
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockQualityGateStatusCondition } from '../../../../helpers/mocks/quality-gates';
-import { mockCurrentUser } from '../../../../helpers/testMocks';
-import { MetricKey } from '../../../../types/metrics';
-import { SonarLintPromotion, SonarLintPromotionProps } from '../SonarLintPromotion';
-
-it('should render correctly', () => {
- expect(shallowRender().type()).toBeNull();
- expect(
- shallowRender({ currentUser: mockCurrentUser({ usingSonarLintConnectedMode: true }) }).type()
- ).toBeNull();
- expect(
- shallowRender({
- qgConditions: [
- mockQualityGateStatusCondition({ metric: MetricKey.new_bugs, level: 'ERROR' }),
- ],
- })
- ).toMatchSnapshot('has failed condition');
-});
-
-it.each(
- [
- MetricKey.new_blocker_violations,
- MetricKey.new_critical_violations,
- MetricKey.new_info_violations,
- MetricKey.new_violations,
- MetricKey.new_major_violations,
- MetricKey.new_minor_violations,
- MetricKey.new_code_smells,
- MetricKey.new_bugs,
- MetricKey.new_vulnerabilities,
- MetricKey.new_security_rating,
- MetricKey.new_maintainability_rating,
- MetricKey.new_reliability_rating,
- ].map(Array.of)
-)('should show message for %s', (metric) => {
- const wrapper = shallowRender({
- qgConditions: [mockQualityGateStatusCondition({ metric: metric as string })],
- });
- expect(wrapper.type()).not.toBeNull();
-});
-
-function shallowRender(props: Partial<SonarLintPromotionProps> = {}) {
- return shallow(<SonarLintPromotion currentUser={mockCurrentUser()} {...props} />);
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 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 { screen } from '@testing-library/react';
+import * as React from 'react';
+import { mockQualityGateStatusCondition } from '../../../../helpers/mocks/quality-gates';
+import { mockCurrentUser } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { MetricKey } from '../../../../types/metrics';
+import { SonarLintPromotion, SonarLintPromotionProps } from '../SonarLintPromotion';
+
+it('should render correctly', () => {
+ renderSonarLintPromotion();
+ expect(
+ screen.queryByText('overview.fix_failed_conditions_with_sonarlint')
+ ).not.toBeInTheDocument();
+
+ renderSonarLintPromotion({ currentUser: mockCurrentUser({ usingSonarLintConnectedMode: true }) });
+ expect(
+ screen.queryByText('overview.fix_failed_conditions_with_sonarlint')
+ ).not.toBeInTheDocument();
+});
+
+it.each(
+ [
+ MetricKey.new_blocker_violations,
+ MetricKey.new_critical_violations,
+ MetricKey.new_info_violations,
+ MetricKey.new_violations,
+ MetricKey.new_major_violations,
+ MetricKey.new_minor_violations,
+ MetricKey.new_code_smells,
+ MetricKey.new_bugs,
+ MetricKey.new_vulnerabilities,
+ MetricKey.new_security_rating,
+ MetricKey.new_maintainability_rating,
+ MetricKey.new_reliability_rating,
+ ].map(Array.of)
+)('should show message for %s', async (metric) => {
+ renderSonarLintPromotion({
+ qgConditions: [mockQualityGateStatusCondition({ metric: metric as string })],
+ });
+
+ expect(
+ await screen.findByText('overview.fix_failed_conditions_with_sonarlint')
+ ).toBeInTheDocument();
+});
+
+function renderSonarLintPromotion(props: Partial<SonarLintPromotionProps> = {}) {
+ return renderComponent(<SonarLintPromotion currentUser={mockCurrentUser()} {...props} />);
+}
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`renders correctly 1`] = `
-<div
- className="page page-limited"
->
- <withRouter(TutorialSelection)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- "version": "0.0.1",
- }
- }
- currentUser={
- {
- "dismissedNotices": {
- "educationPrinciples": false,
- },
- "groups": [],
- "isLoggedIn": true,
- "login": "luke",
- "name": "Skywalker",
- "scmAccounts": [],
- }
- }
- willRefreshAutomatically={true}
- />
-</div>
-`;
-
-exports[`renders correctly 2`] = `
-<div
- className="page page-limited"
-/>
-`;
-
-exports[`renders correctly 3`] = `
-<div
- className="page page-limited"
->
- <Alert
- variant="warning"
- >
- <FormattedMessage
- defaultMessage="provisioning.no_analysis_on_main_branch"
- id="provisioning.no_analysis_on_main_branch"
- values={
- {
- "branchName": "master",
- }
- }
- />
- </Alert>
-</div>
-`;
-
-exports[`renders correctly 4`] = `
-<div
- className="page page-limited"
->
- <withRouter(TutorialSelection)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- "version": "0.0.1",
- }
- }
- currentUser={
- {
- "dismissedNotices": {
- "educationPrinciples": false,
- },
- "groups": [],
- "isLoggedIn": true,
- "login": "luke",
- "name": "Skywalker",
- "scmAccounts": [],
- }
- }
- projectBinding={
- {
- "alm": "github",
- "key": "foo",
- "monorepo": true,
- "repository": "PROJECT_KEY",
- }
- }
- willRefreshAutomatically={true}
- />
-</div>
-`;
-
-exports[`should not render the tutorial for applications 1`] = `
-<div
- className="page page-limited"
->
- <Alert
- variant="warning"
- >
- provisioning.no_analysis.application
- </Alert>
-</div>
-`;
-
-exports[`should render another message when there are branches 1`] = `
-<div
- className="page page-limited"
->
- <Alert
- variant="warning"
- >
- <FormattedMessage
- defaultMessage="provisioning.no_analysis_on_main_branch.bad_configuration"
- id="provisioning.no_analysis_on_main_branch.bad_configuration"
- values={
- {
- "branchName": "master",
- "branchType": "branches.main_branch",
- }
- }
- />
- </Alert>
-</div>
-`;
-
-exports[`should render another message when there are branches 2`] = `
-<div
- className="page page-limited"
->
- <Alert
- variant="warning"
- >
- <FormattedMessage
- defaultMessage="provisioning.no_analysis_on_main_branch.bad_configuration"
- id="provisioning.no_analysis_on_main_branch.bad_configuration"
- values={
- {
- "branchName": "master",
- "branchType": "branches.main_branch",
- }
- }
- />
- </Alert>
-</div>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly for bugs 1`] = `
-<Fragment>
- <ForwardRef(Link)
- aria-label="overview.see_list_of_x_y_issues.1.0.metric.bugs.name"
- className="overview-measures-value text-light"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?pullRequest=1001&resolved=false&types=BUG&inNewCodePeriod=false&id=my-project",
- }
- }
- >
- 1
- </ForwardRef(Link)>
- <BugIcon
- className="big-spacer-left little-spacer-right"
- />
- metric.bugs.name
-</Fragment>
-`;
-
-exports[`should render correctly for bugs 2`] = `
-<Fragment>
- <ForwardRef(Link)
- aria-label="overview.see_list_of_x_y_issues.1.0.metric.new_bugs.name"
- className="overview-measures-value text-light"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?pullRequest=1001&resolved=false&types=BUG&inNewCodePeriod=true&id=my-project",
- }
- }
- >
- 1
- </ForwardRef(Link)>
- <BugIcon
- className="big-spacer-left little-spacer-right"
- />
- metric.new_bugs.name
-</Fragment>
-`;
-
-exports[`should render correctly for code smells 1`] = `
-<Fragment>
- <ForwardRef(Link)
- aria-label="overview.see_list_of_x_y_issues.1.0.metric.code_smells.name"
- className="overview-measures-value text-light"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&inNewCodePeriod=false&id=my-project",
- }
- }
- >
- 1
- </ForwardRef(Link)>
- <CodeSmellIcon
- className="big-spacer-left little-spacer-right"
- />
- metric.code_smells.name
-</Fragment>
-`;
-
-exports[`should render correctly for code smells 2`] = `
-<Fragment>
- <ForwardRef(Link)
- aria-label="overview.see_list_of_x_y_issues.1.0.metric.new_code_smells.name"
- className="overview-measures-value text-light"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&inNewCodePeriod=true&id=my-project",
- }
- }
- >
- 1
- </ForwardRef(Link)>
- <CodeSmellIcon
- className="big-spacer-left little-spacer-right"
- />
- metric.new_code_smells.name
-</Fragment>
-`;
-
-exports[`should render correctly for hotspots 1`] = `
-<Fragment>
- <ForwardRef(Link)
- aria-label="overview.see_list_of_x_y_issues.1.0.metric.security_hotspots.name"
- className="overview-measures-value text-light"
- to={
- {
- "hash": "",
- "pathname": "/security_hotspots",
- "search": "?id=my-project&pullRequest=1001&inNewCodePeriod=false",
- }
- }
- >
- 1
- </ForwardRef(Link)>
- <SecurityHotspotIcon
- className="big-spacer-left little-spacer-right"
- />
- metric.security_hotspots.name
- <HelpTooltip
- className="little-spacer-left"
- overlay="tooltip text"
- />
-</Fragment>
-`;
-
-exports[`should render correctly for hotspots 2`] = `
-<Fragment>
- <ForwardRef(Link)
- aria-label="overview.see_list_of_x_y_issues.1.0.metric.new_security_hotspots.name"
- className="overview-measures-value text-light"
- to={
- {
- "hash": "",
- "pathname": "/security_hotspots",
- "search": "?id=my-project&pullRequest=1001&inNewCodePeriod=true",
- }
- }
- >
- 1
- </ForwardRef(Link)>
- <SecurityHotspotIcon
- className="big-spacer-left little-spacer-right"
- />
- metric.new_security_hotspots.name
- <HelpTooltip
- className="little-spacer-left"
- overlay="tooltip text"
- />
-</Fragment>
-`;
-
-exports[`should render correctly for vulnerabilities 1`] = `
-<Fragment>
- <ForwardRef(Link)
- aria-label="overview.see_list_of_x_y_issues.1.0.metric.vulnerabilities.name"
- className="overview-measures-value text-light"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&inNewCodePeriod=false&id=my-project",
- }
- }
- >
- 1
- </ForwardRef(Link)>
- <VulnerabilityIcon
- className="big-spacer-left little-spacer-right"
- />
- metric.vulnerabilities.name
-</Fragment>
-`;
-
-exports[`should render correctly for vulnerabilities 2`] = `
-<Fragment>
- <ForwardRef(Link)
- aria-label="overview.see_list_of_x_y_issues.1.0.metric.new_vulnerabilities.name"
- className="overview-measures-value text-light"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&inNewCodePeriod=true&id=my-project",
- }
- }
- >
- 1
- </ForwardRef(Link)>
- <VulnerabilityIcon
- className="big-spacer-left little-spacer-right"
- />
- metric.new_vulnerabilities.name
-</Fragment>
-`;
-
-exports[`should render correctly if no values are present 1`] = `
-<Fragment>
- <span
- aria-label="no_data"
- className="overview-measures-empty-value"
- />
- <BugIcon
- className="big-spacer-left little-spacer-right"
- />
- metric.bugs.name
-</Fragment>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly for bugs 1`] = `
-<Fragment>
- <span
- className="flex-1 big-spacer-right text-right"
- >
- metric_domain.Reliability
- </span>
- <Tooltip
- overlay={
- <withAppStateContext(RatingTooltipContent)
- metricKey="reliability_rating"
- value="1.0"
- />
- }
- >
- <span>
- <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="link-no-underline link-rating"
- component="my-project"
- metric="reliability_rating"
- >
- <Rating
- value="1.0"
- />
- </DrilldownLink>
- </span>
- </Tooltip>
-</Fragment>
-`;
-
-exports[`should render correctly for bugs 2`] = `
-<Fragment>
- <span
- className="flex-1 big-spacer-right text-right"
- >
- metric_domain.Reliability
- </span>
- <Tooltip
- overlay={
- <withAppStateContext(RatingTooltipContent)
- metricKey="new_reliability_rating"
- value="1.0"
- />
- }
- >
- <span>
- <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="link-no-underline link-rating"
- component="my-project"
- metric="new_reliability_rating"
- >
- <Rating
- value="1.0"
- />
- </DrilldownLink>
- </span>
- </Tooltip>
-</Fragment>
-`;
-
-exports[`should render correctly for code smells 1`] = `
-<Fragment>
- <span
- className="flex-1 big-spacer-right text-right"
- >
- metric_domain.Maintainability
- </span>
- <Tooltip
- overlay={
- <withAppStateContext(RatingTooltipContent)
- metricKey="sqale_rating"
- value="1.0"
- />
- }
- >
- <span>
- <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="link-no-underline link-rating"
- component="my-project"
- metric="sqale_rating"
- >
- <Rating
- value="1.0"
- />
- </DrilldownLink>
- </span>
- </Tooltip>
-</Fragment>
-`;
-
-exports[`should render correctly for code smells 2`] = `
-<Fragment>
- <span
- className="flex-1 big-spacer-right text-right"
- >
- metric_domain.Maintainability
- </span>
- <Tooltip
- overlay={
- <withAppStateContext(RatingTooltipContent)
- metricKey="new_maintainability_rating"
- value="1.0"
- />
- }
- >
- <span>
- <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="link-no-underline link-rating"
- component="my-project"
- metric="new_maintainability_rating"
- >
- <Rating
- value="1.0"
- />
- </DrilldownLink>
- </span>
- </Tooltip>
-</Fragment>
-`;
-
-exports[`should render correctly for vulnerabilities 1`] = `
-<Fragment>
- <span
- className="flex-1 big-spacer-right text-right"
- >
- metric_domain.Security
- </span>
- <Tooltip
- overlay={
- <withAppStateContext(RatingTooltipContent)
- metricKey="security_rating"
- value="1.0"
- />
- }
- >
- <span>
- <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="link-no-underline link-rating"
- component="my-project"
- metric="security_rating"
- >
- <Rating
- value="1.0"
- />
- </DrilldownLink>
- </span>
- </Tooltip>
-</Fragment>
-`;
-
-exports[`should render correctly for vulnerabilities 2`] = `
-<Fragment>
- <span
- className="flex-1 big-spacer-right text-right"
- >
- metric_domain.Security
- </span>
- <Tooltip
- overlay={
- <withAppStateContext(RatingTooltipContent)
- metricKey="new_security_rating"
- value="1.0"
- />
- }
- >
- <span>
- <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="link-no-underline link-rating"
- component="my-project"
- metric="new_security_rating"
- >
- <Rating
- value="1.0"
- />
- </DrilldownLink>
- </span>
- </Tooltip>
-</Fragment>
-`;
-
-exports[`should render correctly if no values are present 1`] = `
-<Fragment>
- <span
- className="flex-1 big-spacer-right text-right"
- >
- metric_domain.Reliability
- </span>
- <div
- className="padded"
- >
- <Rating />
- </div>
-</Fragment>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`10 days 1`] = `
-<div
- className="overview-legend overview-legend-spaced-line"
->
- overview.new_code_period_x.overview.period.days.10
-</div>
-`;
-
-exports[`date 1`] = `
-<Tooltip
- overlay={
- <DateFormatter
- date={2013-09-21T22:00:00.000Z}
- long={true}
- >
- [Function]
- </DateFormatter>
- }
->
- <div
- className="overview-legend"
- >
- overview.new_code_period_x.overview.period.date.formatted.2013-01-01
- <br />
- <DateFromNow
- date={2013-09-21T22:00:00.000Z}
- >
- <Component />
- </DateFromNow>
- </div>
-</Tooltip>
-`;
-
-exports[`manual_baseline 1`] = `
-<div
- className="overview-legend"
->
- overview.new_code_period_x.overview.period.manual_baseline.formattedTime.2013-09-22T00:00:00+0200
- <br />
- <DateFromNow
- date={2013-09-21T22:00:00.000Z}
- >
- <Component />
- </DateFromNow>
-</div>
-`;
-
-exports[`manual_baseline 2`] = `
-<div
- className="overview-legend"
->
- overview.new_code_period_x.overview.period.manual_baseline.1.1.2
- <br />
- <DateFromNow
- date={2013-09-21T22:00:00.000Z}
- >
- <Component />
- </DateFromNow>
-</div>
-`;
-
-exports[`previous_analysis 1`] = `
-<div
- className="overview-legend"
->
- overview.new_code_period_x.overview.period.previous_analysis.
- <br />
- <DateFromNow
- date={2013-09-21T22:00:00.000Z}
- >
- <Component />
- </DateFromNow>
-</div>
-`;
-
-exports[`previous_version 1`] = `
-<div
- className="overview-legend"
->
- overview.new_code_period_x.overview.period.previous_version_only_date
- <br />
- <DateFromNow
- date={2013-09-21T22:00:00.000Z}
- >
- <Component />
- </DateFromNow>
-</div>
-`;
-
-exports[`should render a more precise date 1`] = `
-<Tooltip
- overlay={
- <DateTimeFormatter
- date={2018-08-16T22:00:00.000Z}
- >
- [Function]
- </DateTimeFormatter>
- }
->
- <div
- className="overview-legend"
- >
- overview.new_code_period_x.overview.period.previous_version_only_date
- <br />
- <DateFromNow
- date={2018-08-16T22:00:00.000Z}
- >
- <Component />
- </DateFromNow>
- </div>
-</Tooltip>
-`;
-
-exports[`version 1`] = `
-<div
- className="overview-legend"
->
- overview.new_code_period_x.overview.period.version.0.1
- <br />
- <DateFromNow
- date={2013-09-21T22:00:00.000Z}
- >
- <Component />
- </DateFromNow>
-</div>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly for coverage 1`] = `
-<div
- className="display-flex-center"
->
- <span
- className="big-spacer-right"
- >
- <CoverageRating
- size="big"
- value={1}
- />
- </span>
- <div
- className="display-flex-column"
- >
- <span>
- <DrilldownLink
- ariaLabel="overview.see_more_details_on_x_of_y.1.0%.metric.coverage.name"
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="overview-measures-value text-light"
- component="my-project"
- metric="coverage"
- >
- 1.0%
- </DrilldownLink>
- </span>
- <span
- className="spacer-top"
- >
- metric.coverage.name
- </span>
- </div>
-</div>
-`;
-
-exports[`should render correctly for coverage 2`] = `
-<div
- className="display-flex-center"
->
- <span
- className="big-spacer-right"
- >
- <CoverageRating
- size="big"
- value={1}
- />
- </span>
- <div
- className="display-flex-column"
- >
- <span>
- <DrilldownLink
- ariaLabel="overview.see_more_details_on_x_of_y.1.0%.metric.coverage.name"
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="overview-measures-value text-light"
- component="my-project"
- metric="coverage"
- >
- 1.0%
- </DrilldownLink>
- </span>
- <span
- className="spacer-top"
- >
- <FormattedMessage
- defaultMessage="overview.coverage_on_X_lines"
- id="overview.coverage_on_X_lines"
- values={
- {
- "count": <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="big"
- component="my-project"
- metric="lines_to_cover"
- >
- 1
- </DrilldownLink>,
- }
- }
- />
- </span>
- </div>
-</div>
-`;
-
-exports[`should render correctly for coverage 3`] = `
-<div
- className="display-flex-center"
->
- <span
- className="big-spacer-right"
- >
- <CoverageRating
- size="big"
- value={1}
- />
- </span>
- <div
- className="display-flex-column"
- >
- <span>
- <DrilldownLink
- ariaLabel="overview.see_more_details_on_x_of_y.1.0%.metric.new_coverage.name"
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="overview-measures-value text-light"
- component="my-project"
- metric="new_coverage"
- >
- 1.0%
- </DrilldownLink>
- </span>
- <span
- className="spacer-top"
- >
- <FormattedMessage
- defaultMessage="overview.coverage_on_X_new_lines"
- id="overview.coverage_on_X_new_lines"
- values={
- {
- "count": <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="big"
- component="my-project"
- metric="new_lines_to_cover"
- >
- 1
- </DrilldownLink>,
- }
- }
- />
- </span>
- </div>
-</div>
-`;
-
-exports[`should render correctly for duplications 1`] = `
-<div
- className="display-flex-center"
->
- <span
- className="big-spacer-right"
- >
- <DuplicationsRating
- size="big"
- value={1}
- />
- </span>
- <div
- className="display-flex-column"
- >
- <span>
- <DrilldownLink
- ariaLabel="overview.see_more_details_on_x_of_y.1.0%.metric.duplicated_lines_density.name"
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="overview-measures-value text-light"
- component="my-project"
- metric="duplicated_lines_density"
- >
- 1.0%
- </DrilldownLink>
- </span>
- <span
- className="spacer-top"
- >
- metric.duplicated_lines_density.short_name
- </span>
- </div>
-</div>
-`;
-
-exports[`should render correctly for duplications 2`] = `
-<div
- className="display-flex-center"
->
- <span
- className="big-spacer-right"
- >
- <DuplicationsRating
- size="big"
- value={1}
- />
- </span>
- <div
- className="display-flex-column"
- >
- <span>
- <DrilldownLink
- ariaLabel="overview.see_more_details_on_x_of_y.1.0%.metric.duplicated_lines_density.name"
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="overview-measures-value text-light"
- component="my-project"
- metric="duplicated_lines_density"
- >
- 1.0%
- </DrilldownLink>
- </span>
- <span
- className="spacer-top"
- >
- <FormattedMessage
- defaultMessage="overview.duplications_on_X_lines"
- id="overview.duplications_on_X_lines"
- values={
- {
- "count": <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="big"
- component="my-project"
- metric="ncloc"
- >
- 1
- </DrilldownLink>,
- }
- }
- />
- </span>
- </div>
-</div>
-`;
-
-exports[`should render correctly for duplications 3`] = `
-<div
- className="display-flex-center"
->
- <span
- className="big-spacer-right"
- >
- <DuplicationsRating
- size="big"
- value={1}
- />
- </span>
- <div
- className="display-flex-column"
- >
- <span>
- <DrilldownLink
- ariaLabel="overview.see_more_details_on_x_of_y.1.0%.metric.new_duplicated_lines_density.name"
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="overview-measures-value text-light"
- component="my-project"
- metric="new_duplicated_lines_density"
- >
- 1.0%
- </DrilldownLink>
- </span>
- <span
- className="spacer-top"
- >
- <FormattedMessage
- defaultMessage="overview.duplications_on_X_new_lines"
- id="overview.duplications_on_X_new_lines"
- values={
- {
- "count": <DrilldownLink
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="big"
- component="my-project"
- metric="new_lines"
- >
- 1
- </DrilldownLink>,
- }
- }
- />
- </span>
- </div>
-</div>
-`;
-
-exports[`should render correctly when centered 1`] = `
-<div
- className="display-flex-column flex-1"
->
- <div
- className="display-flex-center display-flex-justify-center"
- >
- <span
- className="big-spacer-right"
- >
- <CoverageRating
- size="big"
- value={1}
- />
- </span>
- <DrilldownLink
- ariaLabel="overview.see_more_details_on_x_of_y.1.0%.metric.coverage.name"
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- className="overview-measures-value text-light"
- component="my-project"
- metric="coverage"
- >
- 1.0%
- </DrilldownLink>
- </div>
- <div
- className="spacer-top text-center"
- >
- metric.coverage.name
- </div>
-</div>
-`;
-
-exports[`should render correctly with no value 1`] = `
-<div
- className="display-flex-center"
->
- <span
- aria-label="no_data"
- className="overview-measures-empty-value"
- />
- <span
- className="big-spacer-left"
- >
- metric.coverage.name
- </span>
-</div>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correclty 1`] = `
-<li>
- <DrilldownLink
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- component="abcd-key"
- inNewCodePeriod={false}
- metric="open_issues"
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="open_issues"
- metricType="INT"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="open_issues"
- />
- metric.open_issues.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT
-
- 1
- </span>
- </div>
- </div>
- </DrilldownLink>
-</li>
-`;
-
-exports[`should render correclty 2`] = `
-<li>
- <ForwardRef(Link)
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?resolved=false&types=BUG&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&id=abcd-key",
- }
- }
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="reliability_rating"
- metricType="RATING"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="reliability_rating"
- />
- metric.reliability_rating.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT.rating
-
- A
- </span>
- </div>
- </div>
- </ForwardRef(Link)>
-</li>
-`;
-
-exports[`should render correclty 3`] = `
-<li>
- <ForwardRef(Link)
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?resolved=false&types=VULNERABILITY&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&id=abcd-key",
- }
- }
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="security_rating"
- metricType="RATING"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="security_rating"
- />
- metric.security_rating.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT.rating
-
- A
- </span>
- </div>
- </div>
- </ForwardRef(Link)>
-</li>
-`;
-
-exports[`should render correclty 4`] = `
-<li>
- <ForwardRef(Link)
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?resolved=false&types=CODE_SMELL&id=abcd-key",
- }
- }
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="sqale_rating"
- metricType="RATING"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="sqale_rating"
- />
- metric.sqale_rating.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT.rating
-
- A
- </span>
- </div>
- </div>
- </ForwardRef(Link)>
-</li>
-`;
-
-exports[`should render correclty 5`] = `
-<li>
- <ForwardRef(Link)
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?resolved=false&types=BUG&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&inNewCodePeriod=true&id=abcd-key",
- }
- }
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="new_reliability_rating"
- metricType="RATING"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="new_reliability_rating"
- />
- metric.new_reliability_rating.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT.rating
-
- A
- </span>
- </div>
- </div>
- </ForwardRef(Link)>
-</li>
-`;
-
-exports[`should render correclty 6`] = `
-<li>
- <ForwardRef(Link)
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?resolved=false&types=VULNERABILITY&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&inNewCodePeriod=true&id=abcd-key",
- }
- }
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="new_security_rating"
- metricType="RATING"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="new_security_rating"
- />
- metric.new_security_rating.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT.rating
-
- A
- </span>
- </div>
- </div>
- </ForwardRef(Link)>
-</li>
-`;
-
-exports[`should render correclty 7`] = `
-<li>
- <ForwardRef(Link)
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?resolved=false&types=CODE_SMELL&inNewCodePeriod=true&id=abcd-key",
- }
- }
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="new_maintainability_rating"
- metricType="RATING"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="new_maintainability_rating"
- />
- metric.new_maintainability_rating.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT.rating
-
- A
- </span>
- </div>
- </div>
- </ForwardRef(Link)>
-</li>
-`;
-
-exports[`should render correclty 8`] = `
-<li>
- <ForwardRef(Link)
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- to={
- {
- "hash": "",
- "pathname": "/security_hotspots",
- "search": "?id=abcd-key",
- }
- }
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="security_hotspots_reviewed"
- metricType="RATING"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="security_hotspots_reviewed"
- />
- metric.security_hotspots_reviewed.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT.rating
-
- A
- </span>
- </div>
- </div>
- </ForwardRef(Link)>
-</li>
-`;
-
-exports[`should render correclty 9`] = `
-<li>
- <ForwardRef(Link)
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- to={
- {
- "hash": "",
- "pathname": "/security_hotspots",
- "search": "?id=abcd-key&inNewCodePeriod=true",
- }
- }
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="new_security_hotspots_reviewed"
- metricType="RATING"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="new_security_hotspots_reviewed"
- />
- metric.new_security_hotspots_reviewed.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT.rating
-
- A
- </span>
- </div>
- </div>
- </ForwardRef(Link)>
-</li>
-`;
-
-exports[`should work with branch 1`] = `
-<li>
- <ForwardRef(Link)
- className="overview-quality-gate-condition overview-quality-gate-condition-error"
- to={
- {
- "hash": "",
- "pathname": "/project/issues",
- "search": "?resolved=false&branch=branch-6.7&types=CODE_SMELL&inNewCodePeriod=true&id=abcd-key",
- }
- }
- >
- <div
- className="overview-quality-gate-condition-container display-flex-center"
- >
- <div
- className="overview-quality-gate-condition-value text-center spacer-right"
- >
- <Measure
- decimals={2}
- metricKey="new_maintainability_rating"
- metricType="RATING"
- value="3"
- />
- </div>
- <div>
- <span
- className="overview-quality-gate-condition-metric little-spacer-right"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="new_maintainability_rating"
- />
- metric.new_maintainability_rating.name
- </span>
- <span
- className="little-spacer-top small text-muted"
- >
- quality_gates.operator.GT.rating
-
- A
- </span>
- </div>
- </div>
- </ForwardRef(Link)>
-</li>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly: has failed condition 1`] = `
-<div
- className="it__overview__sonarlint-promotion big-spacer-top overview-quality-gate-sonar-lint-info"
->
- <FormattedMessage
- defaultMessage="overview.fix_failed_conditions_with_sonarlint"
- id="overview.fix_failed_conditions_with_sonarlint"
- values={
- {
- "link": <React.Fragment>
- <a
- href="https://www.sonarqube.org/sonarlint/?referrer=sonarqube"
- rel="noopener noreferrer"
- target="_blank"
- >
- SonarLint
- </a>
- <SonarLintIcon
- size={16}
- />
- </React.Fragment>,
- }
- }
- />
-</div>
-`;
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks';
-import { MetricKey } from '../../../../types/metrics';
-import { MeasurementType } from '../../utils';
-import { AfterMergeEstimate, AfterMergeEstimateProps } from '../AfterMergeEstimate';
-
-it('should render correctly for coverage', () => {
- expect(shallowRender()).toMatchSnapshot();
-});
-
-it('should render correctly for duplications', () => {
- expect(
- shallowRender({
- measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) }),
- ],
- type: MeasurementType.Duplication,
- })
- ).toMatchSnapshot();
-});
-
-it('should render correctly with no value', () => {
- expect(shallowRender({ measures: [] })).toMatchSnapshot();
-});
-
-function shallowRender(props: Partial<AfterMergeEstimateProps> = {}) {
- return shallow(
- <AfterMergeEstimate
- measures={[mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) })]}
- type={MeasurementType.Coverage}
- {...props}
- />
- );
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { shallow } from 'enzyme';
-import * as React from 'react';
-import { mockComponent } from '../../../../helpers/mocks/component';
-import { LargeQualityGateBadge } from '../LargeQualityGateBadge';
-
-it('should render correctly for SQ', () => {
- expect(shallowRender()).toMatchSnapshot();
- expect(shallowRender({ level: 'OK' })).toMatchSnapshot();
-});
-
-function shallowRender(props = {}) {
- return shallow(<LargeQualityGateBadge component={mockComponent()} level="ERROR" {...props} />);
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 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 { screen } from '@testing-library/react';
+import * as React from 'react';
+import CurrentUserContextProvider from '../../../../app/components/current-user/CurrentUserContextProvider';
+import { mockPullRequest } from '../../../../helpers/mocks/branch-like';
+import { mockComponent } from '../../../../helpers/mocks/component';
+import { mockQualityGateStatusCondition } from '../../../../helpers/mocks/quality-gates';
+import { mockLoggedInUser, mockMetric, mockPeriod } from '../../../../helpers/testMocks';
+import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { ComponentQualifier } from '../../../../types/component';
+import { MetricKey } from '../../../../types/metrics';
+import { PullRequestOverview } from '../PullRequestOverview';
+
+jest.mock('../../../../api/measures', () => {
+ return {
+ ...jest.requireActual('../../../../types/metrics'),
+ getMeasuresWithMetrics: jest.fn().mockResolvedValue({
+ component: {
+ key: '',
+ name: '',
+ qualifier: ComponentQualifier.Project,
+ measures: [
+ mockQualityGateStatusCondition({
+ error: '1.0',
+ metric: MetricKey.new_coverage,
+ period: 1,
+ }),
+ mockQualityGateStatusCondition({
+ error: '1.0',
+ metric: MetricKey.duplicated_lines,
+ period: 1,
+ }),
+ mockQualityGateStatusCondition({
+ error: '3',
+ metric: MetricKey.new_bugs,
+ period: 1,
+ }),
+ ],
+ },
+ metrics: [
+ mockMetric({ key: MetricKey.new_coverage }),
+ mockMetric({
+ key: MetricKey.duplicated_lines,
+ }),
+ mockMetric({
+ key: MetricKey.new_bugs,
+ type: 'INT',
+ }),
+ ],
+ period: mockPeriod(),
+ }),
+ };
+});
+
+jest.mock('../../../../api/quality-gates', () => {
+ const { mockQualityGateProjectStatus, mockQualityGateApplicationStatus } = jest.requireActual(
+ '../../../../helpers/mocks/quality-gates'
+ );
+ const { MetricKey } = jest.requireActual('../../../../types/metrics');
+ return {
+ getQualityGateProjectStatus: jest.fn().mockResolvedValue(
+ mockQualityGateProjectStatus({
+ status: 'ERROR',
+ conditions: [
+ {
+ actualValue: '2',
+ comparator: 'GT',
+ errorThreshold: '1',
+ metricKey: MetricKey.new_reliability_rating,
+ periodIndex: 1,
+ status: 'ERROR',
+ },
+ {
+ actualValue: '5',
+ comparator: 'GT',
+ errorThreshold: '2.0',
+ metricKey: MetricKey.bugs,
+ periodIndex: 0,
+ status: 'ERROR',
+ },
+ {
+ actualValue: '2',
+ comparator: 'GT',
+ errorThreshold: '1.0',
+ metricKey: 'unknown_metric',
+ periodIndex: 0,
+ status: 'ERROR',
+ },
+ ],
+ })
+ ),
+ getApplicationQualityGate: jest.fn().mockResolvedValue(mockQualityGateApplicationStatus()),
+ };
+});
+
+it('should render correctly for a passed QG', async () => {
+ renderPullRequestOverview({ status: 'OK', conditions: [] });
+
+ expect(await screen.findByText('metric.level.OK')).toBeInTheDocument();
+ expect(screen.queryByText('overview.failed_conditions')).not.toBeInTheDocument();
+});
+
+it('should render correctly if conditions are ignored', async () => {
+ renderPullRequestOverview({ conditions: [], ignoredConditions: true });
+
+ expect(await screen.findByText('overview.quality_gate.ignored_conditions')).toBeInTheDocument();
+});
+
+it('should render correctly for a failed QG', async () => {
+ renderPullRequestOverview({
+ status: 'ERROR',
+ conditions: [
+ mockQualityGateStatusCondition({
+ error: '2.0',
+ metric: MetricKey.new_coverage,
+ period: 1,
+ }),
+ mockQualityGateStatusCondition({
+ error: '1.0',
+ metric: MetricKey.duplicated_lines,
+ period: 1,
+ }),
+ mockQualityGateStatusCondition({
+ error: '3',
+ metric: MetricKey.new_bugs,
+ period: 1,
+ }),
+ ],
+ });
+
+ expect(await screen.findByText('metric.level.ERROR')).toBeInTheDocument();
+
+ expect(await screen.findByText('overview.failed_conditions')).toBeInTheDocument();
+
+ expect(await screen.findByText('metric.new_coverage.name')).toBeInTheDocument();
+ expect(await screen.findByText('quality_gates.operator.GT 2.0%')).toBeInTheDocument();
+
+ expect(await screen.findByText('metric.duplicated_lines.name')).toBeInTheDocument();
+ expect(await screen.findByText('quality_gates.operator.GT 1.0%')).toBeInTheDocument();
+
+ expect(screen.getByText('quality_gates.operator.GT 3')).toBeInTheDocument();
+});
+
+function renderPullRequestOverview(props: Partial<PullRequestOverview['props']> = {}) {
+ renderComponent(
+ <CurrentUserContextProvider currentUser={mockLoggedInUser()}>
+ <PullRequestOverview
+ fetchBranchStatus={jest.fn()}
+ branchLike={mockPullRequest()}
+ component={mockComponent({
+ breadcrumbs: [mockComponent({ key: 'foo' })],
+ key: 'foo',
+ name: 'Foo',
+ })}
+ {...props}
+ />
+ </CurrentUserContextProvider>
+ );
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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 { 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 { waitAndUpdate } from '../../../../helpers/testUtils';
-import { PR_METRICS } from '../../utils';
-import { PullRequestOverview } from '../PullRequestOverview';
-
-jest.mock('../../../../api/measures', () => {
- const { mockMeasure, mockMetric } = jest.requireActual('../../../../helpers/testMocks');
- return {
- getMeasuresWithMetrics: jest.fn().mockResolvedValue({
- component: {
- measures: [
- mockMeasure({ metric: 'new_bugs' }),
- mockMeasure({ metric: 'new_vulnerabilities' }),
- mockMeasure({ metric: 'new_code_smells' }),
- mockMeasure({ metric: 'new_security_hotspots' }),
- ],
- },
- metrics: [
- mockMetric({ key: 'new_bugs', name: 'new_bugs', id: 'new_bugs' }),
- mockMetric({
- key: 'new_vulnerabilities',
- name: 'new_vulnerabilities',
- id: 'new_vulnerabilities',
- }),
- mockMetric({ key: 'new_code_smells', name: 'new_code_smells', id: 'new_code_smells' }),
- mockMetric({
- key: 'new_security_hotspots',
- name: 'new_security_hotspots',
- id: 'new_security_hotspots',
- }),
- ],
- }),
- };
-});
-
-beforeEach(() => {
- jest.clearAllMocks();
-});
-
-it('should render correctly for a passed QG', async () => {
- const fetchBranchStatus = jest.fn();
-
- const wrapper = shallowRender({ fetchBranchStatus, status: 'OK' });
-
- wrapper.setProps({ conditions: [] });
-
- await waitAndUpdate(wrapper);
- expect(wrapper).toMatchSnapshot();
-
- expect(wrapper.find('QualityGateConditions').exists()).toBe(false);
-
- expect(getMeasuresWithMetrics).toHaveBeenCalled();
- expect(fetchBranchStatus).toHaveBeenCalled();
-});
-
-it('should render correctly if conditions are ignored', async () => {
- const wrapper = shallowRender({ conditions: [], ignoredConditions: true });
- await waitAndUpdate(wrapper);
- expect(wrapper.find('Alert').exists()).toBe(true);
-});
-
-it('should render correctly for a failed QG', async () => {
- const wrapper = shallowRender({
- status: 'ERROR',
- conditions: [
- mockQualityGateStatusCondition({
- error: '1.0',
- level: 'OK',
- metric: 'new_bugs',
- period: 1,
- }),
- mockQualityGateStatusCondition({
- error: '1.0',
- metric: 'new_code_smells',
- period: 1,
- }),
- ],
- });
- await waitAndUpdate(wrapper);
- expect(wrapper).toMatchSnapshot();
-});
-
-it('should correctly fetch all required metrics for a passing QG', async () => {
- const wrapper = shallowRender({ conditions: [] });
- await waitAndUpdate(wrapper);
- expect(getMeasuresWithMetrics).toHaveBeenCalledWith('my-project', PR_METRICS, expect.any(Object));
-});
-
-it('should correctly fetch all required metrics for a failing QG', async () => {
- const wrapper = shallowRender({
- conditions: [mockQualityGateStatusCondition({ level: 'ERROR', metric: 'foo' })],
- });
- await waitAndUpdate(wrapper);
- expect(getMeasuresWithMetrics).toHaveBeenCalledWith(
- 'my-project',
- [...PR_METRICS, 'foo'],
- expect.any(Object)
- );
-});
-
-function shallowRender(props: Partial<PullRequestOverview['props']> = {}) {
- return shallow(
- <PullRequestOverview
- branchLike={mockPullRequest()}
- component={mockComponent()}
- fetchBranchStatus={jest.fn()}
- {...props}
- />
- );
-}
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly for coverage 1`] = `
-<div
- className="display-flex-center"
->
- <span
- className="huge"
- >
- 1.0%
- </span>
- <span
- className="label flex-1 spacer-left text-right"
- >
- component_measures.facet_category.overall_category.estimated
- </span>
-</div>
-`;
-
-exports[`should render correctly for duplications 1`] = `
-<div
- className="display-flex-center"
->
- <span
- className="huge"
- >
- 1.0%
- </span>
- <span
- className="label flex-1 spacer-left text-right"
- >
- component_measures.facet_category.overall_category.estimated
- </span>
-</div>
-`;
-
-exports[`should render correctly with no value 1`] = `""`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly for SQ 1`] = `
-<div
- className="overview-quality-gate-badge-large small failed"
->
- <div
- className="display-flex-center"
- >
- <span>
- overview.on_new_code_long
- </span>
- <HelpTooltip
- className="little-spacer-left"
- overlay={
- <FormattedMessage
- defaultMessage="overview.quality_gate.conditions_on_new_code"
- id="overview.quality_gate.conditions_on_new_code"
- values={
- {
- "link": <ForwardRef(Link)
- to={
- {
- "pathname": "/quality_gates/show/Sonar%20way",
- }
- }
- >
- overview.quality_gate
- </ForwardRef(Link)>,
- }
- }
- />
- }
- >
- <HelpIcon
- fill="rgba(255,255,255,0.62)"
- size={12}
- />
- </HelpTooltip>
- </div>
- <div
- className="huge-spacer-top huge h3"
- >
- metric.level.ERROR
- </div>
-</div>
-`;
-
-exports[`should render correctly for SQ 2`] = `
-<div
- className="overview-quality-gate-badge-large small success"
->
- <div
- className="display-flex-center"
- >
- <span>
- overview.on_new_code_long
- </span>
- <HelpTooltip
- className="little-spacer-left"
- overlay={
- <FormattedMessage
- defaultMessage="overview.quality_gate.conditions_on_new_code"
- id="overview.quality_gate.conditions_on_new_code"
- values={
- {
- "link": <ForwardRef(Link)
- to={
- {
- "pathname": "/quality_gates/show/Sonar%20way",
- }
- }
- >
- overview.quality_gate
- </ForwardRef(Link)>,
- }
- }
- />
- }
- >
- <HelpIcon
- fill="rgba(255,255,255,0.62)"
- size={12}
- />
- </HelpTooltip>
- </div>
- <div
- className="huge-spacer-top huge h3"
- >
- metric.level.OK
- </div>
-</div>
-`;
+++ /dev/null
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should render correctly for a failed QG 1`] = `
-<div
- className="page page-limited"
->
- <div
- className="pr-overview has-conditions"
- >
- <div
- className="display-flex-row"
- >
- <div
- className="big-spacer-right"
- >
- <h2
- className="overview-panel-title spacer-bottom small display-inline-flex-center"
- >
- overview.quality_gate
- <HelpTooltip
- className="little-spacer-left"
- overlay={
- <div
- className="big-padded-top big-padded-bottom"
- >
- overview.quality_gate.help
- </div>
- }
- />
- </h2>
- <Memo(LargeQualityGateBadge)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- level="ERROR"
- />
- <withCurrentUserContext(SonarLintPromotion)
- qgConditions={
- [
- {
- "actual": "10",
- "error": "1.0",
- "level": "OK",
- "metric": "new_bugs",
- "op": "GT",
- "period": 1,
- },
- {
- "actual": "10",
- "error": "1.0",
- "level": "ERROR",
- "metric": "new_code_smells",
- "op": "GT",
- "period": 1,
- },
- ]
- }
- />
- </div>
- <div
- className="pr-overview-failed-conditions big-spacer-right"
- >
- <h2
- className="overview-panel-title spacer-bottom small"
- >
- overview.failed_conditions
- </h2>
- <Memo(QualityGateConditions)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- collapsible={true}
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- failedConditions={
- [
- {
- "actual": "10",
- "error": "1.0",
- "level": "ERROR",
- "measure": {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- "metric": "new_code_smells",
- "op": "GT",
- "period": 1,
- },
- ]
- }
- />
- </div>
- <div
- className="flex-1"
- >
- <h2
- className="overview-panel-title spacer-bottom small"
- >
- overview.measures
- </h2>
- <div
- className="overview-panel-content"
- >
- <div
- className="overview-measures-row display-flex-row"
- key="BUG"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <Memo(IssueLabel)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-big-padded overview-measures-aside display-flex-center"
- >
- <Memo(IssueRating)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- useDiffMetric={true}
- />
- </div>
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="VULNERABILITY"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <Memo(IssueLabel)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-big-padded overview-measures-aside display-flex-center"
- >
- <Memo(IssueRating)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- useDiffMetric={true}
- />
- </div>
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="SECURITY_HOTSPOT"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <Memo(IssueLabel)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-big-padded overview-measures-aside display-flex-center"
- >
- <Memo(IssueRating)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- useDiffMetric={true}
- />
- </div>
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="CODE_SMELL"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <Memo(IssueLabel)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-big-padded overview-measures-aside display-flex-center"
- >
- <Memo(IssueRating)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- useDiffMetric={true}
- />
- </div>
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="COVERAGE"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- useDiffMetric={true}
- />
- </div>
- <Memo(AfterMergeEstimate)
- className="overview-panel-big-padded overview-measures-aside text-right overview-measures-emphasis"
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- />
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="DUPLICATION"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- useDiffMetric={true}
- />
- </div>
- <Memo(AfterMergeEstimate)
- className="overview-panel-big-padded overview-measures-aside text-right overview-measures-emphasis"
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- />
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-`;
-
-exports[`should render correctly for a passed QG 1`] = `
-<div
- className="page page-limited"
->
- <div
- className="pr-overview"
- >
- <div
- className="display-flex-row"
- >
- <div
- className="big-spacer-right"
- >
- <h2
- className="overview-panel-title spacer-bottom small display-inline-flex-center"
- >
- overview.quality_gate
- <HelpTooltip
- className="little-spacer-left"
- overlay={
- <div
- className="big-padded-top big-padded-bottom"
- >
- overview.quality_gate.help
- </div>
- }
- />
- </h2>
- <Memo(LargeQualityGateBadge)
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- level="OK"
- />
- <withCurrentUserContext(SonarLintPromotion)
- qgConditions={[]}
- />
- </div>
- <div
- className="flex-1"
- >
- <h2
- className="overview-panel-title spacer-bottom small"
- >
- overview.measures
- </h2>
- <div
- className="overview-panel-content"
- >
- <div
- className="overview-measures-row display-flex-row"
- key="BUG"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <Memo(IssueLabel)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-big-padded overview-measures-aside display-flex-center"
- >
- <Memo(IssueRating)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="BUG"
- useDiffMetric={true}
- />
- </div>
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="VULNERABILITY"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <Memo(IssueLabel)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-big-padded overview-measures-aside display-flex-center"
- >
- <Memo(IssueRating)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="VULNERABILITY"
- useDiffMetric={true}
- />
- </div>
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="SECURITY_HOTSPOT"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <Memo(IssueLabel)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-big-padded overview-measures-aside display-flex-center"
- >
- <Memo(IssueRating)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="SECURITY_HOTSPOT"
- useDiffMetric={true}
- />
- </div>
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="CODE_SMELL"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <Memo(IssueLabel)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- useDiffMetric={true}
- />
- </div>
- <div
- className="overview-panel-big-padded overview-measures-aside display-flex-center"
- >
- <Memo(IssueRating)
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="CODE_SMELL"
- useDiffMetric={true}
- />
- </div>
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="COVERAGE"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- useDiffMetric={true}
- />
- </div>
- <Memo(AfterMergeEstimate)
- className="overview-panel-big-padded overview-measures-aside text-right overview-measures-emphasis"
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="COVERAGE"
- />
- </div>
- <div
- className="overview-measures-row display-flex-row"
- key="DUPLICATION"
- >
- <div
- className="overview-panel-big-padded flex-1 small display-flex-center"
- >
- <MeasurementLabel
- branchLike={
- {
- "analysisDate": "2018-01-01",
- "base": "master",
- "branch": "feature/foo/bar",
- "key": "1001",
- "target": "master",
- "title": "Foo Bar feature",
- }
- }
- component={
- {
- "breadcrumbs": [],
- "key": "my-project",
- "name": "MyProject",
- "qualifier": "TRK",
- "qualityGate": {
- "isDefault": true,
- "key": "30",
- "name": "Sonar way",
- },
- "qualityProfiles": [
- {
- "deleted": false,
- "key": "my-qp",
- "language": "ts",
- "name": "Sonar way",
- },
- ],
- "tags": [],
- }
- }
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- useDiffMetric={true}
- />
- </div>
- <Memo(AfterMergeEstimate)
- className="overview-panel-big-padded overview-measures-aside text-right overview-measures-emphasis"
- measures={
- [
- {
- "bestValue": true,
- "metric": {
- "id": "new_bugs",
- "key": "new_bugs",
- "name": "new_bugs",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_vulnerabilities",
- "key": "new_vulnerabilities",
- "name": "new_vulnerabilities",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_code_smells",
- "key": "new_code_smells",
- "name": "new_code_smells",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- {
- "bestValue": true,
- "metric": {
- "id": "new_security_hotspots",
- "key": "new_security_hotspots",
- "name": "new_security_hotspots",
- "type": "PERCENT",
- },
- "period": {
- "bestValue": true,
- "index": 1,
- "value": "1.0",
- },
- "value": "1.0",
- },
- ]
- }
- type="DUPLICATION"
- />
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-`;
provisioning.no_analysis=No analysis has been performed since creation. The only available section is the configuration.
provisioning.no_analysis.delete=Either you should retry analysis or simply {link}.
provisioning.no_analysis.delete_project=delete the project
-provisioning.no_analysis_on_main_branch="{branchName}" branch has not been analyzed yet.
-provisioning.no_analysis_on_main_branch.bad_configuration="{branchName}" branch has not been analyzed yet and you have multiple branches already. It looks like it is not your {branchType}, check your configuration.
+provisioning.no_analysis_on_main_branch="{0}" branch has not been analyzed yet.
+provisioning.no_analysis_on_main_branch.bad_configuration="{0}" branch has not been analyzed yet and you have multiple branches already. It looks like it is not your {1}, check your configuration.
provisioning.only_provisioned=Only Provisioned
provisioning.only_provisioned.tooltip=Provisioned projects are projects that have been created, but have not been analyzed yet.
provisioning.no_analysis.application=No analysis has been performed since creation. Analyze a project to see information here.