Tell us what’s happening:
Hello! I’m having an issue passing this test. Here is the situation:
- The project passes all inbuilt tests locally, and can access all stock information.
- The project, when uploaded to replit.com, when running passes all inbuilt tests and can access stock information.
- Then this Replit link is pasted into the FCC test, and is in NODE_ENV=test, then no FCC challenges pass and the inbuilt tests timeout.
- When NODE_ENV is anything but test, then all FCC challenges pass EXCEPT the last one, “All 5 functional tests are complete and passing.”, due to disabling the testing.
I have tried adding longer timeout values to server.js like so:
const listener = app.listen(process.env.PORT || 3000, function () {
console.log('Your app is listening on port ' + listener.address().port);
if (process.env.NODE_ENV === 'test') {
console.log('Running Tests...');
setTimeout(function () {
try {
runner.run();
} catch (e) {
console.log('Tests are not valid:');
console.error(e);
}
}, 9500); // Increased from 3000
}
});
And also within each test, like so:
test("Viewing one stock: GET request to /api/stock-prices", function (done) {
chai
.request(server)
.get("/api/stock-prices/")
.set("content-type", "application/json")
.query({ stock: "GOOG" })
.end(function (err, res) {
assert.equal(res.status, 200);
assert.equal(res.body.stockData.stock, "GOOG");
assert.exists(res.body.stockData.price, "GOOG has a price");
done();
});
}).timeout(5000);
If anyone can help me with this I would really appreciate it.
Nick
Your project link(s)
solution: https://replit.com/@newsworthy/stockchecker-1
githubLink: GitHub - Newsworthy/StockChecker
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Challenge: Information Security Projects - Stock Price Checker
Link to the challenge: