I have the following code in one of my tests:
request(test.SERVER_URL)
.post(Endpoint)
.send( { request: requestPayload })
.expect(200)
.end(function(err, res) {
console.log(res)
if (err) return done(err);
done();
});
and in the endpoint function i'm testing, there's this code:
some logic...
....
const result = db.Query
res.json(result)
It works fine when i run the server and hit the endpoint, but when testing with supertest
i get the error:
TypeError: Cannot read property 'address' of undefined
and below it:
'Cannot read property \\'json\\' of undefined
what's wrong?
Aucun commentaire:
Enregistrer un commentaire