{"size": 2951, "ext": "js", "max_stars_repo_path": "DOL.WHD.Section14c.Web/src/modules/services/navService.test.js", "max_stars_repo_name": "joebhaktiarDOL/Section14C", "max_stars_repo_stars_event_min_datetime": "2016-09-22T17:49:04.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-22T14:48:23.000Z", "max_issues_repo_path": "DOL.WHD.Section14c.Web/src/modules/services/navService.test.js", "max_issues_repo_name": "joebhaktiarDOL/Section14C", "max_issues_repo_issues_event_min_datetime": "2016-09-26T13:45:42.000Z", "max_issues_repo_issues_event_max_datetime": "2020-02-12T19:51:33.000Z", "max_forks_repo_path": "DOL.WHD.Section14c.Web/src/modules/services/navService.test.js", "max_forks_repo_name": "joebhaktiarDOL/Section14C", "max_forks_repo_forks_event_min_datetime": "2016-09-26T13:18:39.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-14T09:35:57.000Z"}
{"max_stars_count": 19, "max_issues_count": 887, "max_forks_count": 19, "avg_line_length": 28.1047619048, "max_line_length": 70, "alphanum_fraction": 0.6482548289}
describe('navService', function() {
  var $route, state, nav, autoSave;

  beforeEach(module('14c'));

  beforeEach(
    inject(function($injector, _$route_) {
      $route = _$route_;
      state = { backStack: [] };
      nav = $injector.get('navService');
      autoSave = $injector.get('autoSaveService');
      $route.current = {
        params: {
          section_id: 'wioa'
        }
      };
    })
  );

  it('should set the nextLabel property', function() {
    expect(nav.nextLabel).toEqual(state.nextQuery);
  });

  it('should set the backLabel property', function() {
    expect(nav.backLabel).toEqual(state.backQuery);
  });

  it('should set the hasNext property', function() {
    expect(nav.hasNext()).toEqual('review');
  });

  it('should set the hasBack property', function() {
    nav.hasBack();
    expect(state.backStack.length).toEqual(0);
  });

  it('should go the Next Section on goNext call', function() {
    spyOn(nav, 'getNextSection').and.returnValue('wioa');
    nav.goNext();
    expect(state.nextQuery).toEqual(undefined);
  });

  it('should call the goBack method and clear backQuery', function() {
    spyOn(nav, 'getPreviousSection').and.returnValue('wioa');
    nav.goBack();
    expect(state.backQuery).toEqual(undefined);
  });

  it('should call the gotoSection method', function() {
    spyOn(autoSave, 'save');
    nav.gotoSection('wioa');
    expect(state.backStack.length).toEqual(0);
  });

  it('should call the clearQuery method', function() {
    nav.clearQuery();
    //expect($location).toEqual(undefined);
  });

  it('should call the pushToBack method', function() {
    nav.pushToBack('wioa', {});
    expect(state.backStack.length).toEqual(0);
  });

  it('should call the setNextQuery method', function() {
    nav.setNextQuery({}, 'label');
    expect(state.nextQuery).toEqual(undefined);
  });

  it('should call the clearNextQuery method', function() {
    nav.clearNextQuery();
    expect(state.nextQuery).toEqual(undefined);
  });

  it('should call the setBackQuery method', function() {
    nav.setBackQuery({}, 'label');
    expect(state.backQuery).toEqual(undefined);
  });

  it('should call the clearBackQuery method', function() {
    nav.clearBackQuery();
    expect(state.backQuery).toEqual(undefined);
  });

  it('should return the next section if not at the end', function() {
    var current = 'assurances';
    expect(nav.getNextSection(current)).toEqual('app-info');
  });

  it('should return undefined if it is at the end', function() {
    var current = 'review';
    expect(nav.getNextSection(current)).toEqual(undefined);
  });

  it('should return the previous seciton in the array', function() {
    var current = 'wioa';
    expect(nav.getPreviousSection(current)).toEqual('work-sites');
  });

  it('should return undefined if first section', function() {
    var current = 'assurances';
    expect(nav.getPreviousSection(current)).toEqual(undefined);
  });
});
