Quality Assurance Projects - Issue Tracker

All 14 Tests Are Passing But I Get an Error That Won’t Let Me Proceed :
As described in the title. Is this a bug or am I missing something?

solution: boilerplate-project-issuetracker - Replit

githubLink: GitHub - Gerald-Simpson/boilerplate-project-issuetracker

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

Challenge: Quality Assurance Projects - Issue Tracker

Link to the challenge:

Did you set NODE_ENV === 'test' in the environment variables?

If I do that all the test time out :confused:

Ok, so I added test back in and now I’m getting a new error. The test again are all showing as passed but then I’m getting this error. How can I be passing the tests but getting this error that’s in one of the tests?
My solution link is updated.

I had a look at your code and there are issues with earlier tests. I’ll have a play around with it when I get home and let you know if I figure out why your res.body[0] is coming up undefined.

Thanks. I can’t for the life of me work out why it’s returning undefined.
I also don’t understand why the tests are showing as passed even though they clearly aren’t…

A lot of the tests really should POST data before testing it. You shouldn’t rely on hardcoded values, they should be the actual values you get back from using the API.

Apologies, I didn’t get a chance for a proper look at your code until now.
The good news is that I forked your repl and played around with it and now it works.


The bad news is that I’m not entirely sure what was causing it to fail previously, though there were a number of issues which I fixed (all in the functional-tests file).
I’m working right now but I’ll come back to you again later with my findings…

Thanks dude. I’ve had another go at this now that I’ve taken a break and I think I worked out my issues.
I think all the tests are passing now with no errors. But when I click ‘I completed this challenge’ all the tests seem to time out with freeCodeCamp. Any ideas how I get this to pass?

Thanks for all your help guys. I spammed running it and got it to pass!

Glad you got it working in the end!

There is a problem with the tests hanging the repl (which then causes the FCC tests to timeout). I think that some of the boilerplates have recently been updated to prevent this but - if you experience this issue again - another simple fix is to add this to the bottom of your functional-tests file:

after(function() {
  chai.request(server)
  .get('/')
});

This restarts the repl, preventing the timeouts caused by a hanging repl.

The only other observation I have is that you use assert.equal for all of your tests.
It’s no criticism but, if I want to assert that something is an object for instance, I’d personally use assert.isObject(res.body[0], 'res.body[0] is an object'). There’s a whole library of useful assertions which can make the code a little cleaner I think.

Hey,
I forgot to say, thanks for this. I implemeneted this on the next project :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.