Fix floating point math precision
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user