URL Shortener Feedback :)

Hello there :wave:

Here’s my finished URL Shortener:

Project: simple-short-url-microservice.herokuapp.com

Source Code: github.com/sitek94/url-shortener-microservice

I’d greatly appreciate your feedback, thank you! :partying_face:

Project instructions and user stories: URL Shortener Microservice by freeCodeCamp

1. You have a mistake in the README - instead of .sample.env there is .env.example.

2. The test for dnsLookup is failing for me:

Expected: "ENOTFOUND"
Received: "EAI_AGAIN"

I looked at the docs and seems that this behavior depends on operating system (I’m on linux).

3. Tests in shorturl.test.ts depend on the order (i.e. if you put 'GET /:short_url' first, the tests will fail).

4. url-validator.test.ts doesn’t test anything, because error-handler.ts handles error and returns status 200, therefore catch is not called (and if it were called, it would fail anyway because to use toHaveBeenCalled you need to use mock/spy).

That just some things I noticed after quick look.
P.S. Kudos for TypeScript and tests :slight_smile:

Btw: https://simple-short-url-microservice.herokuapp.com/api/shorturl/13 :smiling_imp:

1 Like

Wow, thank you so much! That’s extremely valuable!! I’m now going to go through everything you said :slight_smile:

Hahah I see what you did here, I’ll restrict the app’s hostname :smiley:


All right I think I got it all fixed now.

  1. fixed
  2. I created a custom error so it should be now independed of operating system, etc.
  3. Ah, so this is what testing in isolation means, right? I updated these tests and added some cleanup so it should be fine now.
  4. fixed

Once again thanks for your help and feedback, @jenovs !!!