1

I'm newbie about angular testing and I'm challenging this scenario. This function (not written by me) return a promise object:

GetByEmail: function (email) {
var def = $q.defer();
this.InvokeMyApi(
    this.ApiParams.EntryPoints.Account.Mode,
    this.ApiParams.EntryPoints.Account.GetState,
    {},
    { Email: email }).then(
    function (e) {
        def.resolve(e.data);
    }, function (e) {
        def.reject(e);
    });
return def.promise;

}

My goal is to test it with Qunit so I'm trying to read the promise content with this one:

var promise = GetByEmail(email);
promise.then(function (data) {
    console.log('successo ', data);
}, function (error) {
    console.log('errore ', error);
});

It seems so simple but nothing happens when I try to run the second function. Any help for me?

svdaniele
  • 11
  • 2

0 Answers0