You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just would like to test if the post was added using a fake Meteor.user() to test it.
This is a simple test which is not working, because of Meteor.user() object:
varassert=require("assert");suite("Post",function(){test("publish a new post",function(done,server){server.eval(function(){Post.find().observe({added: function(doc){emit("added",doc);}});Post.publish("Ola!");});server.once("added",function(doc){assert.equal(doc.message,"Ola!");done();});});});
Does anybody can help me solving this?
Thanks!
The text was updated successfully, but these errors were encountered:
I am currently working around this by simply testing in with a "real" and logged in user. This can be done by calling Accounts.createUser({email: 'a@a.com', password: '123456'}); on the server and something like
Meteor.loginWithPassword('a@a.com', '123456', function() {
Post = new Meteor.Collection('posts');
Post.publish = function(message) {
var currentUser = Meteor.user();
this.insert({
message: message
, time: new Date()
, userId: currentUser._id
, name: currentUser.profile.name
});
};
});
Hi, I'm new using Laika, and I'd like to know how can I mock Meteor.user() object, testing this function:
I just would like to test if the post was added using a fake Meteor.user() to test it.
This is a simple test which is not working, because of Meteor.user() object:
Does anybody can help me solving this?
Thanks!
The text was updated successfully, but these errors were encountered: