I think I have completed the Metric-Imperial converter, I wrote all of the convertHandler, and all of the unit tests and functional tests and all are passing, but when I try to submit the project it always errors out on these test:
I can convert ‘gal’ to ‘L’ and vice versa. (1 gal to 3.78541 L)
I can convert ‘lbs’ to ‘kg’ and vice versa. (1 lbs to 0.453592 kg)
I can convert ‘mi’ to ‘km’ and vice versa. (1 mi to 1.60934 km)
I know that these are working because when I type in those values in the UI and hit Convert, they show up with the correct converted values. Any ideas on why these tests won’t pass? I see a bunch of posts about the QA projects not being fully implemented, so maybe that is why? Should I just wait for a while until those are sorted out? I’d be bummed to make it this far and not be able to complete the courses because they aren’t complete.
I have not debugged fully, but here is some usefull information:
The challenge was updated recently. These changes have not reached production yet (there were some delays with recent restructuring)
The challenge is currently being worked on, including the boilerplate, and I doubt your current boilerplate will be compatible (I am unsure).
I cannot speak for when the changes will be live. So, one thing you can do is make sure your chai/mocha tests are testing properly, then at least you know you have got a handle, and can port your code over, once the changes are live.
Thank you for your help. I did make sure my chai/mocha tests are working and all of them are passing. I’ll hold off on these projects for the time being since they are still under construction and come back to them later.
I was having the same issue. The issue for me was, the test is actually expecting a lower-case ‘L’ in the returned JSON ‘returnUnit’ key (not helpful when the user story specifically says ‘L’…) Try making sure it returns ‘l’ for liters and see if that fixes it!
I was in the same problem as you: all tests passing but those 3, even when they were working fine… And I finally found the solution. Checking your code, it’s probably the same issue, so check this:
In api.js, returnNum expects a number with 5 decimals. Your convert function in convertHandler.js is returning more decimals, so instead of directly returning the result of the operation in the switch, try to reduce it to just 5.