Hello,
I'm trying to stub Meteor.user in server.promise to return random user using sinon. The problem is sinon becomes undefined when I use it inside server.promise even when I add it as parameter. Is there anyway to use it inside server.promise
const sinon = require('sinon');
return server.promise(function (resolve, reject, sinon) {
sinon.stub(Meteor, 'user').returns({username: 'testuser'});
Meteor.call('Report.add', data, function(err, result) {
if(err) {
reject(err);
} else {
resolve(result);
}
},[sinon]);
}).then(function (err) {
expect(err).to.be.an('null');
});
It gives me this error Error: Cannot call method 'stub' of undefined
Thanks
Hello,
I'm trying to stub
Meteor.userinserver.promiseto return random user usingsinon. The problem issinonbecomesundefinedwhen I use it insideserver.promiseeven when I add it as parameter. Is there anyway to use it insideserver.promiseIt gives me this error
Error: Cannot call method 'stub' of undefinedThanks