I have a middleware in an API like this :api.validate = function (req, res, next) {let err = new Error("ERROR THROWN");next(err);}Now I am trying to test it like this :it('validateQuery error testing', function (done) {this.timeout(0);let req = {};_.set(req, 'query.params.prefix', '2');brand.validateQuery(req, {}, next);function next(err) {console.log("Next called");}})But next called is not getting printed. Am I missing something here? I am still beginner in Node and maybe I am reading it completely wrong.
Submitted March 23, 2020 at 06:58AM by GhostFoxGod
No comments:
Post a Comment