Reputation: 343
I'm trying to set up some test data for my environment that is using Velocity along with Cucumber and Jasmine.
I'm trying to do something pretty normal - setting up some test data in the db beforehand.
I'm running into some issues that seem related to how async behavior works in Meteor. I'm used to using Promises but they don't seem to be an option on this platform.
I want to:
Below is some code from my fixture file in tests/cucumber/features
// make a user - it correctly writes to my cucumber db
Meteor.wrapAsync(
Accounts.createUser({
email: "[email protected]",
password: "password"
})
)
// Do a find for that user
var theUser = Meteor.wrapAsync(Meteor.users.findOne({emails: {$elemMatch: {address: "[email protected]"}}}))
// log out that user. The console returns `[Function]` rather than the result of the find. How do I get the result of the find?
console.log(theUser)
Upvotes: 0
Views: 113
Reputation: 343
Ok, figured out the answer. Maybe this will help someone else. The find didn't need to be wrapped in Meteor.wrapAsync
Upvotes: 1