Metric Converter, cant pass fraction test & mocha tests not runnning

Tell us what’s happening:
I’ve almost completed my imperial metric converter project, in fact as far as I can tell it is working properly, but I am not passing the fraction test (even though I can input a fraction and get the correct answer)

My other issue is that I think the functional tests should be passing just fine, but the assignment page says otherwise. I have not really worked on the unit tests, as it doesn’t appear that either are running in the first place.

Your code so far
View my Repl at this link

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.

Challenge: Metric-Imperial Converter

Link to the challenge:

Hello there,

Have you copied the contents of sample.env into your own .env file?

I have now… Thanks so much, not sure when I was supposed to learn this though.

I managed to finish all the tests, but I’m now running into the issue of the fraction part passing. Although it functions correctly, the user story “I can use fractions, decimals or both in my parameter(ie. 5, 1/2, 2.5/6), but if nothing is provided it will default to 1.” will not pass.

Hey again,

When I run this: https://boilerplate-project-metricimpconverter.sethalan.repl.co/api/convert?input=1/5mi

I see this output:

{"initNum":"1/5","initUnit":"mi","returnNum":0.32187,"returnUnit":"km","string":"1/5 miles converts to 0.32187 kilometers"}

The issue here is the initNum is not supposed to be a string.

Hope this helps

I changed it so that it returns a float instead and edited my tests to expect that result, but there is no change in the user story.

This still returns a string:
https://boilerplate-project-metricimpconverter.sethalan.repl.co/api/convert?input=mi

{"initNum":"1","initUnit":"mi","returnNum":1.60934,"returnUnit":"km","string":"1 miles converts to 1.60934 kilometers"}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.