Я ищу решение для тестирования методов Meteor с мокко. Я использую Velocity и пакет Mocha.Вызов и тестирование метеорных методов с помощью Mocha
Это пример метода, который я пытаюсь проверить.
Meteor.methods({
addPoints: function(userId, points) {
return Players.update(userId, { $inc: { score: +points } });
}
});
Это, в кружным путем, как я назвал бы его с помощью узла, я хочу, чтобы вызывать методы с аргументами и утверждают, что в этом случае она возвращает 1 для обновления Монго документа
if (!(typeof MochaWeb === 'undefined')){
MochaWeb.testOnly(function(){
describe("Meteor Method: Upldating a player", function(){
// define the handler as the method we are testing
// May be this needs to be a before each.
var handler = Meteor.call("addPoints");
var userId = "1";
var points = 5;
describe("Updating a player", function() {
it("Should Add a point", function(done){
handler(userId, points, function() {
assert(handler.calledOnce);
// a way here of asserting the callback is what we expect,
// in this case we expect a return of 1
done();
});
});
});
});
});
}
Thanks