EmberJs-如何在qunit Unit TEST中拒绝Ember.RSVP.Promise?

时间:2017-08-01 13:50:20

标签: ember.js ember-qunit

var stubMyService=Ember.Object.extend({
        //'authenticator:ooion( OAuth,username, password)
        authenticate(OAuth2,username,password)
         {
           return new Ember.RSVP.Promise(function(reject){
               Ember.run(null,reject,obj);
           });
          }
      });

1 个答案:

答案 0 :(得分:0)

回调到RSVP.Promise接受2个参数 - 解析并拒绝。

return new Ember.RSVP.Promise(function(resolve, reject) {
    Ember.run(null, reject, obj);
});

或者,在ES2017语法中:

return new Ember.RSVP.Promise((resolve, reject) => Ember.run(null, reject, obj));