-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Hi,
I'm implementing some unit tests for my Meteor methods and I'm running into the issue that I can't create a simple object with a factory. The reason for this is simpleschema trying to add this.userId as the author in my colletion.
I have the following set in my schema:
author: {
type: String,
autoValue: function () {
if (this.isInsert) {
return this.userId;
}
}
}
When running my tests I get the error that author has to be set, and even if I add it to the factory, the simpleschema will set it to undefined because this.userId is not set.
I initially thought of creating a user and login in as the user, but I haven't been able to get this working on the server side. Alternatively, I read something about replacing this.userId with a default value, but I'm not sure how to go and implement that. Would you have any suggestions on how to go ahead and solve this issue?
Thank you in advance!