I'm new to unit testing in the Node world and am struggling with this: I've setup a after cb to delete the records I've added during my tests, however I keep getting an error Error: done() called multiple times
every time I delete the record on the db. Here's my code:
after((done) => {
User.deleteOne({email: user_email}, function(err, result) {
if(err) console.log(err);
console.log(result);
done();
});
});
If I do anything else (like just console something within the after
block, I get no error at all.
What am I doing wrong?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.