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: "harry@example.com",
password: "password"
})
)
// Do a find for that user
var theUser = Meteor.wrapAsync(Meteor.users.findOne({emails: {$elemMatch: {address: "harry@example.com"}}}))
// 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)
Ok, figured out the answer. Maybe this will help someone else. The find didn't need to be wrapped in Meteor.wrapAsync
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.