Hi all, I am doing the Metric-Imperial Converter, but I cannot seem to pass the tests:
- If the unit of measurement is invalid, returned will be
'invalid unit'
. - If the number is invalid, returned will be
'invalid number'
. - If both the unit and number are invalid, returned will be
'invalid number and unit'
.
All other tests are passing. My solution is definitely not the cleanest, but I went over it a couple times, as well as tried to enter different values, and it seems to work as expected. What I do notice, is that if I console.log the āinputā in api.js, then the last two lines when I ācheckā the tests is āundefinedā. I have no idea what would need to be entered in input to simulate that. I manually tried all the other values that appeared there, and those all work fine.
I tried to find the values that the tests are using online, but I could not get to them, and I guess I just cannot imagine the inputs that are failing.
One other thing I do notice, is that the UI refreshes only when valid values (example ā put in 1gal ā works, ā try to put in blank value ā still shows result for the 1gal conversion.
Here is my code - https://repl.it/@Aigarsss/boilerplate-project-metricimpconverter
Thank you in advance.
Totally unrelated:
Sometimes when I run it, all the tests in the console pass, but repl crashes and wont load the page. Not sure if its somethin im doing, or something wronf with repl. Crashes donāt happen if I comment out the runner.run(); line.
Challenge: Metric-Imperial Converter
Link to the challenge: