どのようにゲディコントローラを単体テストしますか? これは私がテストしたい例です。
var assert = require('assert')
, tests
, controller = geddy.controller.create('Users');
tests = {
'test user controller, add new user': function (next) {
var user = User.create({username: 'hbinduni',
password: 'MyPassword!',
confirmPassword: 'MyPassword!',
familyName: 'binduni',
givenName: 'binduni',
email: 'hbinduni@email.com'});
//need to unit test controller.add here
//how to mock req, resp?
controller.add(req, resp, user);
assert.equal(out, null);
next();
}
};
module.exports = tests;
コントローラーメソッドで単体テストを行うにはどうすればよいですか? リクエストとレスポンスをモックする方法は?
ありがとうございました。