Ember.js Ember.RSVP.hash和验收测试
我有一个从服务调用的哈希:Ember.js Ember.RSVP.hash和验收测试,ember.js,ember-cli,Ember.js,Ember Cli,我有一个从服务调用的哈希: return new Ember.RSVP.hash({ locations: ajax( { url: applicationConfig.apiUrl + '/api/v1/locations/search?term=' + term }), listingEvents: ajax({ url: applicationConfig.apiUrl + '/api/v1/listi
return new Ember.RSVP.hash({
locations: ajax(
{
url: applicationConfig.apiUrl + '/api/v1/locations/search?term=' + term
}),
listingEvents: ajax({
url: applicationConfig.apiUrl + '/api/v1/listingevents/search?term=' + term
})
});
现在在我的测试中,我得到:
✘ Error: Assertion Failed: You have turned on testing mode, which disabled the run-loop's autorun.
You will need to wrap any code with asynchronous side-effects in a run
我已经将散列包在一个Ember.run
中,但这不起作用
让哈希在验收测试中运行的最佳方法是什么?在您调用的地方。然后根据最终的承诺,在那里您必须在Ember.run.Hmmm中包装代码。它尝试了这一点,但仍在抱怨:/RSVP.hash不是构造函数。你不需要新的。不确定是否相关。删除了<代码>新的,但仍然得到了相同的失败:/Where调用。然后从结果承诺中,您必须在那里包装代码。run.Hmmm尝试了这一点,但它仍然在抱怨:/RSVP.hash不是构造函数。你不需要新的。不确定是否删除了相关的
新的,但仍然得到相同的失败:/