Tell us what’s happening:
I’ve been working on this project for days now. I started this project locally and got all the unit and functional tests to pass. But when uploading my url in FCC it won’t pass 2 tests:
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.
I’m not sure how to go about the first one. Tried adding .toUpperCase/.toLowerCase instances originally and nothing worked. Maybe I just had them in wrong spots, but IDK.
I’m not sure how the last one doesn’t pass, it works for me and never shows more than 5 decimals. Unless they want it to show 5 decimals at all times (e.g. 4/2 = 2.00000 instead of 2). Any help getting these 2 tests to pass is greatly appreciated!
@Aigarsss
Thank you for your reply and taking the time to try to help me. I didn’t realize it showed the front-end in full screen without showing an option to see the code. As you can tell I don’t post for help much in here, lol. However, it was hard to post code, when the problems I’m having I’m not sure what file or file(s) they are coming from. So I figured it was easier to provide the whole project.
In regards to your suggestions, the parentheses around the (s) didn’t make a difference. I’m returning the json object just as you posted above. And the 1st suggestion about removing one of the l’s, I already tried that. It doesn’t like that and throws errors due to the forEach() in the unit testing. And for some reason it doesn’t like when I put two L’s. And if I make so ‘L’ is only accepted in the input then it will still fail because they want inputs to accept both upper and lower case, but return lowercase, except for ‘L’
So I’m so confused and nothing I’ve tried had worked so far. Like I said, all the unit and functional tests pass, but every time I try to modify the array or add some code to get the 2 tests above to pass, it breaks and makes some of the unit/functional tests not pass. These 2 tests are so frustrating, lol.