Merge branch 'upstream-master' into gh-3811-repo-url-file-registration

This commit is contained in:
Jussi Hallila
2021-01-19 08:16:51 +01:00
3 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-lighthouse': patch
---
Fix display of floating point precision errors in card category scores
@@ -38,7 +38,7 @@ const websiteListResponse = data as WebsiteListResponse;
let entityWebsite = websiteListResponse.items[2];
describe('<LastLighthouseAuditCard />', () => {
const asPercentage = (fraction: number) => `${fraction * 100}%`;
const asPercentage = (fraction: number) => `${Math.round(fraction * 100)}%`;
beforeEach(() => {
(useWebsiteForEntity as jest.Mock).mockReturnValue({
@@ -27,7 +27,7 @@ import { useWebsiteForEntity } from '../../hooks/useWebsiteForEntity';
import AuditStatusIcon from '../AuditStatusIcon';
const LighthouseCategoryScoreStatus = ({ score }: { score: number }) => {
const scoreAsPercentage = score * 100;
const scoreAsPercentage = Math.round(score * 100);
switch (true) {
case scoreAsPercentage >= 90:
return (