mercredi 18 novembre 2015

unit testing async-waterfall using mocha

I am using Mocha as a testing framework for my node.js application.

I have an existing module that uses async-waterfall node module.I am trying to write a unit test case for it. I am unable to write a test case for the second function in the array.Any tips on how would I pass the result of one function to the next function in the array var async = require('async');

module.exports.resetPassword = function(req,res,next){
 async.waterfall([
  function(done){
    var token = do something;
    done(err,token);
  },
   function(token,done){
       //do some stuff
     res.status(200).send('success');
   },
    ]function(err){ 
     //send failure response
     });
};

Aucun commentaire:

Enregistrer un commentaire