Log the route input and output that you are returning and the failing one looks like
req.query: {"input":"1/5mi"}
{
initNum: '0.20000',
initUnit: 'mi',
returnNum: 0.32187,
returnUnit: 'km',
string: '0.20000 miles converts to 0.32187 kilometers'
}
So, in your getNum fraction handling, you are returning a string instead of a float and it is getting returned in the initNum property as a string. Looks like your regular expressions are not exactly what you intend.
At least on the version I just ported. I’m not seeing the error you posted; the browser console is indicating that '0.20000' is not a number.
Thanks for the reply! I forgot to convert the result to float. But the 10th test still wouldn’t pass for me. I checked the console and this is the error:
Error: expected 1.5 to be close to 1.111111111111111 +/- 0.001