Test broken - could pass anything; url-shortener-microservice project

URL Shortener Microservice - Test broken!

The test seems to be broken. Checked in solution of previous challenge by accident and it passed the test. Now I checked in the correct solution, hopefully (can’t be sure, because it also passed intermediate states…)


Exercise Tracker - Test broken as well!
File Metadata Microservice - Test broken as well!
(added: 2019-12-03T23:00:00Z)


Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice

Hi @philipp.coding, I also ran into this issue on the APIs & Microservices projects and found out the tests for the APIs & Microservices projects are not yet implemented according to this forum post and this GitHub issue. Fortunately some awesome people implemented tests for both backend certifications in these two Glitch apps:

2 Likes

Thank you so much @monksy for the links :smiling_face_with_three_hearts:

All my projects pass :star_struck:
… except: URL Shortener

Although redirecting seems to be working when I try it manually… What am I missing?
This is my code for redirecting the shortened links:

// shorturl endpoint
app.route("/api/shorturl/:short").get((req, res) => {
  let short_url = parseInt(req.params.short)
  let index = urls.findIndex(item => item.short_url === short_url);
  if (index === -1) return res.send({"error":"invalid short-URL"});
  // console.log(urls[index].original_url)
  // console.log(index) 
  res.redirect(urls[index].original_url);
})

No problem. I had the same issue. I think those two tests may not be working correctly, since they also failed when I ran the tests on the reference project provided by freeCodeCamp (https://thread-paper.glitch.me)

1 Like

So true - was actually stupid of me not to test this :see_no_evil:
Thanks again :blush:

No worries, it took me a while to figure that out myself. Happy coding! :grinning: