Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ember.js Ember.RSVP.hash和验收测试_Ember.js_Ember Cli - Fatal编程技术网

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不是构造函数。你不需要新的。不确定是否删除了相关的
新的
,但仍然得到相同的失败:/