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
- If the number is invalid, returned will be
- 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.
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: