Bchandaria 0 Newbie Poster
angular
    .module('abc')
    .factory('dashboard', dashboard);
    function dashboard($http, notifier) {
      var service = {
      getAllMasterJobsNames: getAllMasterJobsNames
      };
      return service;
      function getAllMasterJobsNames(request) {
      return $http.post('/JSONServices/JSONCampusManagementService.svc/GetAllMasterJobsNames', request).then(
        function (response) {
          if (angular.isUndefined(response.data) || (angular.isDefined(response.data.IsException) && response.data
              .IsException)) {
            notifier.error('Error fetching the Active Events : ' + JSON.stringify(response));
          }
          return response;
        },
        function (response) {
          notifier.error('Error fetching the Active Events : ' + JSON.stringify(response));
          return response;
        });
    }
 }
})();

service.js


'use strict';

describe('dashboardService', function () {
  var dashboardService;

  beforeEach(module('abc'));

  beforeEach(inject(function (_dashboard_) {
    dashboardService = _dashboard_;
  }));
   it('getAllMasterJobsNames method should defined and should return promise', function () {
    expect(dashboard.getAllMasterJobsNames).toBeTruthy();
    expect(dashboard.getAllMasterJobsNames.name).toEqual('getAllMasterJobsNames');
    expect(dashboard.getAllMasterJobsNames(0)).toEqual({$$state:{status:0}});

  });
});

any one please can help me out for unit test case which verifies the data fetch from json file???