我正在尝试为下面的类似中间件模块创建测试。我正在使用摩卡&柴,我被困在如何从测试文件中实际调用module.exports = function(){
var middleware = {};
middleware.doSomething= function(temp) {
return temp;
}
return middleware;
};
函数。有关如何做的任何建议?
middleware.js
var foo = require('./middleware');
var assert = require('chai').assert;
describe('middleware test', function() {
it('doSomething test', function(done) {
//call the doSomething function
});
});
test.js
{{1}}