I have the following function on my application.
convertToPercent(number) {
if (!number) return 'N/A';
return Number(number / 100).toLocaleString('pt-br', { style: 'percent' });
}
and then I just created the following test scenario
it('Should convertToPercent(10) return "10%" ' , () => {
expect(component.convertToPercent(10)).toEqual('10%');
})
But then When I'm running the tests it's broken because 0.1 is not equal to 10%.
Does anyone have some idea of what it can be?
When running the application it's working.
Thank you, Lucas.
Aucun commentaire:
Enregistrer un commentaire