comment retourner refus de l'échec promesse de par jasmine espion angulaire contrôleur dans un test unitaire

Je suis à l'aide de jasmin pour tester mon angulaire des contrôleurs.
Je suis le rattrapage d'erreurs et de succès dans le .then(successCallback, errorCallback)
Bien qu'il fonctionne bien sur les bases de vivre fonctionnalité, mais je suis confus comment écrire un espion pour retourner une erreur, car il est toujours pris dans le successCallback()

Suivant est le contrôleur :-

angular.module('myApp')
.controller('LoginCtrl', function ($scope, $location, loginService, SessionService) {
    $scope.errorMessage = '';

    $scope.login = function () {

      var credentials = {
          email: this.email,
          password: this.password
      };

     SessionService.resetSession();
     var request = loginService.login(credentials);

     request.then(function(promise){ //successfull callback
        if (promise['status'] === 200){
             //console.log('login');
            $location.path('/afterloginpath');
        }
      },
     function(errors){  //fail call back
      // console.log(errors);
        $location.path('/login');
     });
    };
});

Mon cas de test :-

'use strict';
describe('Controller: LoginCtrl', function () {
//load the controller's module
beforeEach(module('myApp'));
var LoginCtrl, scope, location, login, loginReturn, session;
var credentials = {'email': '[email protected]', 'password': 'admin123'};
//Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope, $location, _loginService_, _SessionService_) {
scope = $rootScope.$new();
LoginCtrl = $controller('LoginCtrl', {
$scope: scope
});
location = $location;
login = _loginService_;
session = _SessionService_;
scope.errorMessage = '';
spyOn(login, "login").andCallFake(
function(){
return {
then: function(response){
response(loginReturn);
}
}
}
);
spyOn(session, "setName").andCallFake(function(){
return true;
});
}));
it('should go to login when login fail', function () {
loginReturn = function(){
return{
successfullyCallback: {throwError:true},
failCallback: {status: 400, 'data' : {'errors' : [{"type":"invalid_data","target":"email,password"}]}}
}
};
var wrong_creds = {email: '[email protected]', password: 'wrong_password'};
scope.email = wrong_creds.email;
scope.password = wrong_creds.password;
scope.login();
expect(location.path()).toBe("/login");
expect(scope.errorMessage).toBe('username or password combination is invalid');
});
});