const intl = useIntl();
- if (!rating || rating === 'A') {
+ if (rating === undefined) {
return null;
}
);
}
+ const maintainabilityMessageId =
+ softwareQuality === SoftwareQuality.Maintainability
+ ? `.${SoftwareQuality.Maintainability}`
+ : '';
+
const softwareQualityLabel = intl.formatMessage({
id: `software_quality.${softwareQuality}`,
});
return intl.formatMessage(
{
- id: 'overview.measures.software_impact.improve_rating_tooltip',
+ id:
+ rating === 'A'
+ ? `overview.measures.software_impact.improve_rating_tooltip${maintainabilityMessageId}.A`
+ : `overview.measures.software_impact.improve_rating_tooltip${maintainabilityMessageId}`,
},
{
softwareQuality: softwareQualityLabel,
import { mockQualityGateProjectStatus } from '../../../../helpers/mocks/quality-gates';
import { mockLoggedInUser, mockMeasure, mockPaging } from '../../../../helpers/testMocks';
import { renderComponent } from '../../../../helpers/testReactTestingUtils';
-import { byLabelText, byRole, byText } from '../../../../helpers/testSelector';
+import { byRole, byText } from '../../../../helpers/testSelector';
import { SoftwareImpactSeverity, SoftwareQuality } from '../../../../types/clean-code-taxonomy';
import { ComponentQualifier } from '../../../../types/component';
import { MetricKey } from '../../../../types/metrics';
},
[false, true, false],
);
+ await ui.expectSoftwareImpactMeasureCardRatingTooltip(
+ SoftwareQuality.Security,
+ 'B',
+ 'overview.measures.software_impact.improve_rating_tooltip.software_quality.SECURITY.software_quality.security.B.overview.measures.software_impact.severity.LOW.improve_tooltip',
+ );
+
ui.expectSoftwareImpactMeasureCard(
SoftwareQuality.Reliability,
'A',
undefined,
true,
);
+ await ui.expectSoftwareImpactMeasureCardRatingTooltip(
+ SoftwareQuality.Reliability,
+ 'A',
+ 'overview.measures.software_impact.improve_rating_tooltip.A.software_quality.RELIABILITY.software_quality.reliability.A.overview.measures.software_impact.severity.LOW.improve_tooltip',
+ );
+
ui.expectSoftwareImpactMeasureCard(
SoftwareQuality.Maintainability,
'E',
},
[false, false, true],
);
+ await ui.expectSoftwareImpactMeasureCardRatingTooltip(
+ SoftwareQuality.Maintainability,
+ 'E',
+ 'overview.measures.software_impact.improve_rating_tooltip.MAINTAINABILITY.software_quality.MAINTAINABILITY.software_quality.maintainability.E.overview.measures.software_impact.severity.HIGH.improve_tooltip',
+ );
});
// eslint-disable-next-line jest/expect-expect
ui.expectSoftwareImpactMeasureCard(SoftwareQuality.Security);
expect(
- byLabelText(
- `overview.project.software_impact.has_rating.software_quality.${SoftwareQuality.Security}.B`,
- ).get(),
+ ui.softwareImpactMeasureCardRating(SoftwareQuality.Security, 'B').get(),
).toBeInTheDocument();
ui.expectSoftwareImpactMeasureCard(SoftwareQuality.Reliability);
expect(
- byLabelText(
- `overview.project.software_impact.has_rating.software_quality.${SoftwareQuality.Reliability}.A`,
- ).get(),
+ ui.softwareImpactMeasureCardRating(SoftwareQuality.Reliability, 'A').get(),
).toBeInTheDocument();
ui.expectSoftwareImpactMeasureCard(SoftwareQuality.Maintainability);
expect(
- byLabelText(
- `overview.project.software_impact.has_rating.software_quality.${SoftwareQuality.Maintainability}.E`,
- ).get(),
+ ui.softwareImpactMeasureCardRating(SoftwareQuality.Maintainability, 'E').get(),
).toBeInTheDocument();
});
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import userEvent from '@testing-library/user-event';
-import { byRole, byTestId, byText } from '../../../helpers/testSelector';
+import { byLabelText, byRole, byTestId, byText } from '../../../helpers/testSelector';
import {
SoftwareImpactMeasureData,
SoftwareImpactSeverity,
overallCodeButton: byRole('tab', { name: /overview.overall_code/ }),
softwareImpactMeasureCard: (softwareQuality: SoftwareQuality) =>
byTestId(`overview__software-impact-card-${softwareQuality}`),
+ softwareImpactMeasureCardRating: (softwareQuality: SoftwareQuality, rating: string) =>
+ byLabelText(
+ `overview.project.software_impact.has_rating.software_quality.${softwareQuality}.${rating}`,
+ ),
};
const ui = {
...selectors,
expect(link).not.toHaveClass('active');
}
},
+ expectSoftwareImpactMeasureCardRatingTooltip: async (
+ softwareQuality: SoftwareQuality,
+ rating: string,
+ text: string,
+ ) => {
+ await expect(
+ ui.softwareImpactMeasureCardRating(softwareQuality, rating).get(),
+ ).toHaveATooltipWithContent(text);
+ },
};
return { user, ui };
};
overview.measures.software_impact.severity.LOW=L
overview.measures.software_impact.severity.LOW.tooltip=Low Impact
overview.measures.software_impact.severity.LOW.improve_tooltip=low
-overview.measures.software_impact.improve_rating_tooltip={softwareQuality} rating is a {ratingLabel} when there is at least one issue with {severity} impact on the {_softwareQuality} of your software.
+overview.measures.software_impact.improve_rating_tooltip=The {softwareQuality} rating is {ratingLabel} when there is at least one issue with {severity} impact on the {_softwareQuality} of your software.
+overview.measures.software_impact.improve_rating_tooltip.A=The {softwareQuality} rating is {ratingLabel} when there are no issues with impact on the {_softwareQuality} of your software.
+overview.measures.software_impact.improve_rating_tooltip.MAINTAINABILITY=The Maintainability rating is {ratingLabel} if the code has a relatively higher level of technical debt when compared to the size of the codebase.
+overview.measures.software_impact.improve_rating_tooltip.MAINTAINABILITY.A=The Maintainability rating is A if the code has a relatively lower level of technical debt when compared to the size of the codebase.
overview.project.no_lines_of_code=This project has no lines of code.
overview.project.empty=This project is empty.