Tag: sinon stubbing

用Sinon.JS来扼杀asynchronousstream水

我想通过使用Sinon.js来扼杀我的一个函数来testingasync.waterfall 。 // functions.js module.exports = { // function I don't want to run doBigThing: function() { console.log("[doBigThing] was called"); }, // function I want to stub myFunction: function(number, callback) { console.log("[myFunction] was called"); doBigThing(); callback(null, number); }, // function I want to test waterfall: function(callback) { return async.waterfall([ async.constant(5), // 5 just for the […]