title: Angular Unit Test : No pending request to flush
body: <p>I am new to Karma so this might sound trivial. I have the following route structure in place.</p>
  
  <pre><code>  angular
          .module('appRouter',['ui.router'])
          .config(function($stateProvider,$urlRouterProvider){
              $stateProvider
                  .state('settings.profile',{
                      url:'/profile',
                      templateUrl:'templates/profile.html'
                  })
                  .state('settings.account',{
                      url:'/account',
                      templateUrl:'templates/account.html',
                      controller:function(resolveData){
                          console.log(resolveData);
                      },
                      resolve:{
                          resolveData : function($http){
                              var root = 'https://jsonplaceholder.typicode.com';
                              return $http.get(root+'/posts/1').then(function(response){
  
                                  return response.data;
                              });
                          }
                      }
                  });
  
              $urlRouterProvider.otherwise('/settings/profile');  
  </code></pre>
  
  <p><strong>Now the unit test for it looks like below. Please note I am trying to test resolve functionality also</strong> </p>
  
  <pre><code>describe('UI Routerer Config For Account',function(){
      var $state,$rootScope,$injector,$httpBackend,state = "settings.account";
  
      beforeEach(function(){
          module('appRouter');
      });
  
      beforeEach(inject(function(_$rootScope_,_$injector_,_$state_,_$httpBackend_,$templateCache){
          $rootScope = _$rootScope_;
          $state = _$state_;
          $injector = _$injector_;
          $httpBackend = _$httpBackend_;
          $templateCache.put('templates/account.html','');
      }));
  
      it('should resolve "resolveData"',function(){
          const state = $state.get('settings.account');
          const resolveFn = state.resolve.resolveData;
  
          $httpBackend.when('GET','https://jsonplaceholder.typicode.com/posts/1').respond(200,{
             "userId": 1,
              "id": 1,
              "title": "...",
              "body": "..."       
          });
          $httpBackend.expectGET('https://jsonplaceholder.typicode.com/posts/1');
          $httpBackend.flush();
  
          const responseData = {
              "userId": 1,
              "id": 1,
              "title": "...",
              "body": "..."
          };
  
          expect(resolveData).toEqual(responseData);
      });
  
  });
  </code></pre>
  
  <p><strong>But this fails</strong> :</p>
  
  <pre><code> should resolve "resolveData"
       UI Routerer Config For Account
       Error: No pending request to flush !
      at Function.$httpBackend.flush (bower_components/angular-mocks/angular-mocks.js:1816:41)
      at Object.&lt;anonymous&gt; (test/controllers/main-controller-spec.js:97:22)
  </code></pre>
  
  <p>What am I doing wrong ? Please explain.</p>