<commit_before>// TODO: not working yet
/*
import { TestBed, inject, ComponentFixture } from '@angular/core/testing';
import { Location } from '@angular/common';
import { Router, RouteRegistry, ROUTER_PRIMARY_COMPONENT } from '@angular/router-deprecated';
import { RootRouter } from '@angular/router-deprecated/src/router';
import { SpyLocation } from '@angular/common/testing';

import { DashboardComponent } from './dashboard.component';
import { HeroService } from '../heroes/hero.service';
import { Hero } from '../heroes/hero';

describe('DashboardComponent', () => {

  let fixture: ComponentFixture<DashboardComponent>;
  let component: DashboardComponent;
  let heroService: HeroService;

  function mockServiceFactory() : HeroService {
    heroService = jasmine.createSpyObj<HeroService>('HeroService', [
       'getHeroes', 'getHeroesSlowly', 'getHero']);

    return <HeroService>heroService;
  }

  beforeEach(() => {
    // refine the test module by declaring the test component
    TestBed.configureTestingModule({
      declarations: [ DashboardComponent ],
    });

    // create component and test fixture
    fixture = TestBed.createComponent(DashboardComponent);

    // get test component from the fixture
    component = fixture.componentInstance;
  });


  beforeEach(() => [
    DashboardComponent,
    provide(HeroService, {useFactory: mockServiceFactory}),
    RouteRegistry,
    provide(Location, {useClass: SpyLocation}),
    provide(ROUTER_PRIMARY_COMPONENT, {useValue: DashboardComponent}),
    provide(Router, {useClass: RootRouter})
  ]);

  it('true is true', () => expect(true).toBe(true));

  it('should have empty heroes', inject([ DashboardComponent ], (dashboard: DashboardComponent) => {
    expect(dashboard.heroes).toEqual([]);
  }));

});

*/<commit_msg>refactor(dashboard): enable unit tests<commit_after>import { TestBed, inject, async, ComponentFixture } from '@angular/core/testing';
import { Router } from '@angular/router';

import { DashboardComponent } from './dashboard.component';
import { HeroService } from '../heroes/hero.service';

describe('DashboardComponent', () => {

  function buildRouter(): Router {
    const router = jasmine.createSpyObj<Router>('Router', [
      'navigate',
    ]);

    return <Router>router;
  }

  function buildServiceFactory() : HeroService {
    const heroService = jasmine.createSpyObj<HeroService>('HeroService', [
       'getHeroes', 'getHeroesSlowly', 'getHero']);

    return <HeroService>heroService;
  }

  beforeEach(async(() => {
    // refine the test module by declaring the test component
    TestBed.configureTestingModule({
      declarations: [
        DashboardComponent,
      ],
      providers: [
        { provide: Router, useFactory: buildRouter },
        { provide: HeroService, useFactory: buildServiceFactory },
      ],
    });

    TestBed.compileComponents();
  }));

  it('should start with empty heroes', () => {
    const fixture = TestBed.createComponent(DashboardComponent);
    const component = fixture.componentInstance;

    expect(component.heroes).toEqual([]);
  });

});
{'fraction_non_alphanumeric': 0.13589412524209168, 'fraction_numerical': 0.0, 'mean_word_length': 4.217171717171717, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5210032', 'n_tokens_mistral': 891, 'n_tokens_neox': 872, 'n_words': 195}