diff --git a/src/components/HomeCards/TotalConsumption.spec.tsx b/src/components/HomeCards/TotalConsumption.spec.tsx index 76b499c5cf0b5d862d3ab316d1ca5df9a0e657c3..5b92a4442a6ef275271d466bf1d3bf234f840853 100644 --- a/src/components/HomeCards/TotalConsumption.spec.tsx +++ b/src/components/HomeCards/TotalConsumption.spec.tsx @@ -37,7 +37,7 @@ describe('TotalConsumption component', () => { .find('.euro-value') .first() .text() - ).toEqual('20.23') + ).toEqual('20,23') }) it('should call Converter method', () => { const mockLoadToEuro = jest.fn() @@ -59,6 +59,6 @@ describe('TotalConsumption component', () => { .find('.euro-value') .first() .text() - ).toEqual('130.84') + ).toEqual('130,84') }) }) diff --git a/src/components/HomeCards/TotalConsumption.tsx b/src/components/HomeCards/TotalConsumption.tsx index d1e024c8de9be9c45550e99274cf5d7b315b8a24..fd6c7b8e3971133932616aa6220506b16c714866 100644 --- a/src/components/HomeCards/TotalConsumption.tsx +++ b/src/components/HomeCards/TotalConsumption.tsx @@ -5,6 +5,7 @@ import './totalConsumption.scss' import { Dataload } from 'models' import { FluidType } from 'enum/fluid.enum' import ConverterService from 'services/converter.service' +import { formatNumberValues } from 'utils/utils' interface TotalConsumptionProps { actualData: Dataload[] fluidType: FluidType @@ -27,11 +28,10 @@ const TotalConsumption: React.FC<TotalConsumptionProps> = ({ totalValue <= 0 ? '-----' : fluidType === FluidType.MULTIFLUID - ? totalValue.toFixed(2).toString() - : converterService - .LoadToEuro(totalValue, fluidType) - .toFixed(2) - .toString() + ? formatNumberValues(totalValue).toString() + : formatNumberValues( + converterService.LoadToEuro(totalValue, fluidType) + ).toString() return displayedValue } setTotalValue(calculateTotalValue())