[英]Meteor.js Async Help: Setting Up Test Data on the Server
我正在尝试为使用Velocity以及Cucumber和Jasmine的环境设置一些测试数据。
我正在尝试做一些非常正常的事情-事先在数据库中设置一些测试数据。
我遇到了一些问题,这些问题似乎与Meteor中异步行为的工作方式有关。 我习惯于使用Promises,但在该平台上似乎并不是一个选择。
我想要:
下面是我的tests/cucumber/features
文件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)
好,找出答案。 也许这会帮助别人。 发现不需要包裹在Meteor.wrapAsync
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.