OK, lets try this again:
First, thanks for the kudos, but sadly my mind wouldn’t let it rest.
So, there are ways to kinda tell what the tests are doing. One, this is an open-source site meaning you have access to the source code. It’s probably possible to find the tests in their github, although I’ve never tried and not sure if they frown on that. If you’re using it to troubleshoot a troublesome issue its probably fine, using it as a shortcut to cheat the testing… yeah, not good.
But more easily accessible is console.log()
. Outputting to console or debug terminal helps to track down troublesome issues. The FCC tests run your code to get their results, and you can see any outputs of console.log()
in your replit console as the tests run.
Funny thing though… I attempted to do this with your code. I forked it so I could edit it, and in the reply delete function I put a header that uses console.log to print out all the inputs at the start of the function, and then right before each res.send
I outputed to console the results. This way during the test you get a peak into what was sent to your app, and what the output was, and can help you find weird unexpected issues.
Problem is, when I did this, all output looked fine, and surprisingly all the FCC site tests passed, except for the functional tests part because I hadn’t set the NODE_ENV
to ‘test’. All I did was fork your code, had to create a DB .env
secret variable for my database, and added the console outputs, and all the tests in FCC site passed.
So to finish I attempted to set NODE_ENV
to ‘test’ but I couldn’t get the functional test to run. Looking at your functional tests, I couldn’t make sense of how you had it setup. You had imported all your database schema and hash function stuff, and for some reason the server you’re sending all your Chai server requests with comes from a SECRET variable SERVER??? The classes and all examples I’ve seen just use App
for this.
const server = process.env.SERVER;
Without knowning how you setup your server I couldn’t duplicate the tests. I tried testing with App and it gave errors. I also attempted using my own tests, but they also wouldn’t run due to how you have it setup. Never seen anybody set the chai server up as an ENV variable. Getting the functional tests to work would have required a major rewrite on my part it seemed, so I stopped there. I did cheat the functional tests by setting them all to assert.equals(5,5) and with that all tests do pass on FCCs page.
So… in conclusion??? I guess one of two things is causing your repeated failure. One, your Replit is messed up, and forking it into a new replit, and resetting up your ENV variables might fix the problem. Two is its something to do with your complex functional tests that might be messing something up. Without knowing how you set that up I can’t really be sure.
You could try disabling your functional tests by setting NODE_ENV
to something besides ‘test’. If your Reply Delete FCC test passes with your functional tests disabled then it might be something with your testing. Otherwise, if even with your testing disabled it fails, then maybe try forking your Replit into a new replit and see if that works.
You could also do what I wasn’t able to as I couldn’t duplicate the error, and use console.log to observe the inputs and what the outputs are during the FCC tests… that might reveal a potential cause for the failures.
Or, could just diregard it like you said, and move on.
I would like to know… what did you set your ENV SECRET variable SERVER to for your Chai testing, and is there a guide or tutorial for doing that that you followed?