EmberJs-如何在 qunit 单元测试中拒绝 Ember.RSVP.Promise?

EmberJs-How to reject an Ember.RSVP.Promise in qunit Unit TEST?

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);
           });
          }
      });

回调 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));