The challenge requirements seem met but I can’t get it to pass test 2 and 3 and there are no errors so I don’t know what else I can do. My guess there’s something i the test that isn’t showing in the requirements page.
Any help would be be appreciated.
One thing I did notice is that an address such as “www.glitch.com” will not generate an error on my version. I don’t see why this is a problem since I passes my dns test and works with forwarding.
I could try psl - npm and try to generate an error when a user as an address similar to “www..com”
The FCC tests are passing url like
Is your helper function handling such case too?
I used a URL object. And pull out the properties protocol and hostname for testing.
const urlObj = new URL(req.body.url)
//check urlObj.protocol is http: or https:
//pass urlObj.hostname to dns.lookup
You might give a URL object a try and see if it makes any difference.
Good point! No helper function isn’t handling it like it should . I assumed it worked because this project used to pass the FCC tests(I didn’t submit it a while ago because I wanted to refactor it). I’ll try experimenting and getting to know the URL better and come back with my findings. Thank you!
Just a quick follow up. It’s working now. The key here would have been to spend more time doing TDD first before trying to refactor the code. Once it worked I refactored it some more.
Also studying the test performed by FCC was a lot of help.
I’ll focus on TDD(Test driven development) for my next projects. Thanks for your help!
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.