title: jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL
body: <p>I have an angular service called <code>requestNotificationChannel</code>:</p>
  
  <pre><code>app.factory("requestNotificationChannel", function($rootScope) {
  
      var _DELETE_MESSAGE_ = "_DELETE_MESSAGE_";
  
      function deleteMessage(id, index) {
          $rootScope.$broadcast(_DELETE_MESSAGE_, { id: id, index: index });
      };
  
      return {
         deleteMessage: deleteMessage
      };
  
  });
  </code></pre>
  
  <p>I am trying to unit test this service using jasmine:</p>
  
  <pre><code>"use strict";
  
  describe("Request Notification Channel", function() {
      var requestNotificationChannel, rootScope, scope;
  
      beforeEach(function(_requestNotificationChannel_) {
          module("messageAppModule");
  
          inject(function($injector, _requestNotificationChannel_) {
              rootScope = $injector.get("$rootScope");
              scope = rootScope.$new();
              requestNotificationChannel = _requestNotificationChannel_;
          })
  
          spyOn(rootScope, '$broadcast');
      });
  
  
      it("should broadcast delete message notification", function(done) {
  
          requestNotificationChannel.deleteMessage(1, 4);
          expect(rootScope.$broadcast).toHaveBeenCalledWith("_DELETE_MESSAGE_", { id: 1, index: 4 });
          done();       
      });
  });
  </code></pre>
  
  <p>I read about the Asynchronous Support in Jasmine, but as I am rather new to unit testing with javascript couldn't make it work.</p>
  
  <p>I am receiving an error :   </p>
  
  <pre><code>Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL
  </code></pre>
  
  <p>and my test is taking too long to execute (about 5s).</p>
  
  <p>Can somebody help me providing working example of my code with some explanation?</p>