Metric-Imperial Converter not passing 2 tests

My project is failing on 2 tests (which to me does not make sense). The tests that are failing are these:
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'

. What really isn’t making sense is that the 2 tests not passing are inside this 3 part statement:

        res.send( 'invalid number and unit' );
      } else if (!initNum ) {
        res.send( 'invalid number' );
      } else if (!initUnit) {
        res.send( 'invalid unit' );
      }

I’ve spent the past 2 hours trying to modify code and nothing passes, and what is more infuriating is I can see on my own screen that it is definitely returning those items. I tried changing to return as a json object, still will not pass. Why does the third return just fine but the other two don’t?

code can be found here:
https://glitch.com/edit/#!/bloom-excessive-runner

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

Challenge: Metric-Imperial Converter

Link to the challenge:

The tests are passing in /api/convert?input=1//2gal and /api/convert?input=1//2min and when I log your req.query.input, it is 1/2gal and 1/2min which are valid and an invalid unit only. Something somewhere is swallowing a slash. I know I’ve seen the slash problem in the forums before. I don’t know if the fCC side could encode the slash and it get through on glitch to your route or not.

The good news is it works from the page served from the app. The other good news is that repl.it seems to pass the slashes through. So, maybe try running the project there.

Thanks! It went right through on repl.it.

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