AngularJS and UI-Router: 'Error: transition superseded' during angularjs unit tests : <p>I'm attempting to create an authorization package for a project of mine. I'm getting the error 'transition superseded' during my unit tests, and I can't find out where that would actually be.</p>

<p>Unit test:</p>

<pre><code>import angular from 'angular';
import 'angular-mocks';
import worldManagerApp from '../../src/world-manager-app';
import security from '../../src/security/security';

const {inject, module} = angular.mock;

describe('LoginService', ()=&gt; {
    let $httpBackend;
    let $rootScope;
    let successHandler;
    let errorHandler;
    let LoginService;

    const USER = {username: "TEST", password: "PASSWORD"};

    beforeEach(function() {
        module(worldManagerApp);
        module(security);

    });

    beforeEach(inject((_$httpBackend_, _LoginService_, _$rootScope_) =&gt; {
        $httpBackend = _$httpBackend_;
        $rootScope = _$rootScope_;
        LoginService = _LoginService_;

        successHandler = jasmine.createSpy('successHandler');
        errorHandler = jasmine.createSpy('errorHandler');
    }));

    it('should exist', () =&gt; {
        expect(LoginService).toBeDefined();
    });

    describe('.login()', () =&gt; {

        describe('when given a proper username and password', () =&gt; {
           it('should return the username and success', () =&gt; {
               $httpBackend.expectPOST('/login').respond(200, {user: USER});
               LoginService.login("TEST", "PASSWORD");
               $rootScope.$digest();
               $httpBackend.flush();

               expect($rootScope.currentUser).toEqual("TEST");
           });
        });
    });

});
</code></pre>

<p>Service:</p>

<pre><code>export default function LoginService($http){
    'ngInject';

    let service = {};
    service.login = login;

    function login(username, password){
        $http({
            url:'/login',
            method: 'POST',
            data: {
                username: username,
                password: password,
            },
        }).then (function(response) {
            response.username;
        }).catch(function(response){
        });
    }

    return service;
}
</code></pre>

<p>Error:</p>

<pre><code>PhantomJS 1.9.8 (Windows 8 0.0.0) LoginService .login() when given a proper username and password should return the username and success FAILED
        Error: transition superseded
            at C:/Users/Manifest/AppData/Local/Temp/353229d8bf0abe298e7003bab30c0528.browserify:9387 &lt;- node_modules/angular-mocks/angular-mocks.js:261:0
            at processChecks (C:/Users/Manifest/AppData/Local/Temp/353229d8bf0abe298e7003bab30c0528.browserify:33750 &lt;- node_modules/angular/angular.js:16674:0)
            at C:/Users/Manifest/AppData/Local/Temp/353229d8bf0abe298e7003bab30c0528.browserify:35048 &lt;- node_modules/angular/angular.js:17972:0
            at C:/Users/Manifest/AppData/Local/Temp/353229d8bf0abe298e7003bab30c0528.browserify:34862 &lt;- node_modules/angular/angular.js:17786:0
            at C:/Users/Manifest/AppData/Local/Temp/353229d8bf0abe298e7003bab30c0528.browserify:521 &lt;- frontend\test\security\loginService.spec.js:42:15
</code></pre>

<p>I assume it's a ui-Router problem, but I can't figure out how it should work if I am doing it wrong.</p>
