Trying to unit test in Karma with AngularMock if my function has returned a promise that was rejected but can't seem to find ANYTHING surprisingly on the matter.

I have a service like UserService, which has a function: `processIdentityResponse` which returns a promise that is either resolved or rejected depending on the logic inside:

```
processIdentityResponse: function(response)
{
    var deferred = $q.defer();
    if (response.data.banned) {
        deferred.reject(response);
    } else {
        deferred.resolve(response);
    }   
    return deferred.promise;
}

```

I want to test that if the banned property exists then a rejected promise is returned and if not, that it is resolved... how can I achieve this?

I tried something like the following to no success:

```
it('should return a rejected promise if status is a string', function() {
    var rejected = false;
    UserService.processIdentityResponse(data).catch(function() {
        rejected = true;
    });
    expect(rejected).toBe(true);
});

```