[英]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.