Section: Quality Assurance
Project: Issue Tracker
Issue:
I can’t seem to pass the test for getting all issues for a project without filtering. The thing is my code passes the test for getting all filtered issues . I tried removing the filtering implementation and just filter using the project field but it still doesn’t pass. I testing my code locally and the get request works for both filtered and unfiltered.
Does FCC test the routes independently or is there a chance the tests depend on other tests passing as well? I don’t have the PUT route finished yet FYI.
My Get Route:
.get(function (req, res){
let project = req.params.project;
// Data filter
let filter = {
project: project
}
// Check for query filtering
if(Object.keys(req.query).length > 0) {
filter = {
project: project,
...req.query
}
}
// Find issues for project
Issue.find({
...filter
}, (err, data) => {
if(err) return console.log("Error:\n" + err)
res.json(data)
// Hide unnecessary fields
}).select({ project: 0, __v: 0 })
})