Metric-Imperial Converter Fails

// running tests
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’.
// tests completed

The cloned project itself in boilerplate tells me that the two errors are now OK, but it shows me other errors that were OK in Glitch.

// running tests
You can convert ‘gal’ to ‘L’ and vice versa. (1 gal to 3.78541 L)
All incoming units should be accepted in both upper and lower case, but should be returned in both the initUnit and returnUnit in lower case, except for liter, which should be represented as an uppercase ‘L’.
Your 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.
All 16 unit tests are complete and passing.
All 5 functional tests are complete and passing.
// tests completed

Your project link(s)


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.67

Challenge: Metric-Imperial Converter

Link to the challenge:

For the Repl one. Looks like it is the returnUnit that is incorrect. It should be capital L.

Looking at the tests can be pretty helpful. I know they are not shown as part of the challenge but it really isn’t unreasonable to know what is being tested against.

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