I have completed the metric-converter project which passes all the tests in Replit but does not pass the following unit tests when I submit the solution code to fcc:
X - You can use fractions, decimals or both in the parameter (ie. 5, 1/2, 2.5/6), but if nothing is provided it will default to 1.
X - our return will consist of the initNum
, initUnit
, returnNum
, returnUnit
, and string
spelling out units in the format '{initNum} {initUnitString} converts to {returnNum} {returnUnitString}'
with the result rounded to 5 decimals
I have looked at these particular tests and have tried making changes to the code in the converterHandler but none of my changes fixes the problem. In the unit tests I see getNum value as: 0.512333333333 and tried rounding this but it does not fix the problem. I have added the . env file contents in the replit secret key as required.
I would appreciate some help on what the problem may be.
My Repl code link is: https://replit.com/@dwtoddeng/metric-imperial-converter