Hi,
This is a story with a few twists. It started like below
I 'm failing this put test and the delete test
You can send a
PUT
request to/api/issues/{projectname}
with an_id
and one or more fields to update. On success, theupdated_on
field should be updated, and returned should be{ result: 'successfully updated', '_id': _id }
In my console I get two error messages that I do not understand :
Error: expected { Object (id, assigned_to…) } to be an array
Error: expected { status: ‘unavailable’ } to be an array
I looked through all the posts on the forum and I discoverd the problem could lie in my get route. I had a findOne for requests with an id and find() for other requests in there. I got rid of the findOne and fixed the code in the rest of the function. PUT worked smoothly, delete still didn’t.
So I thought, I can’t sleep, let’s work on it a little more.
But then both tests started failing again. And I’m getting CORS not origin allowed messages again. I found some code in the chai-mocha replit and copied it into the issue tracker. Put passes again, delete still doesn’t.
let error;
app.get('/_api/get-tests', cors(), function (req, res, next) {
if (error)
return res.json({ status: 'unavailable' });
next();
},
function (req, res, next) {
if (!runner.report) return next();
res.json(testFilter(runner.report, req.query.type, req.query.n));
},
function (req, res) {
runner.on('done', function (report) {
process.nextTick(() => res.json(testFilter(runner.report, req.query.type, req.query.n)));
});
});
Now I’m getting
Error: expected { status: ‘unavailable’ } to be an array
and
CORS-header ‘Access-Control-Allow-Origin’ is missing
Christ, I’m tired. I need to sleep.
Here’s a link to my replit : KarinMeersman-issuetracker-1.karinmeersman.repl.co
Thanks and greets,
Karin