6: Get Data from a Server
[examples/angular-tour-of-heroes] / src / app / dashboard / dashboard.component.spec.ts
1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
3 import { DashboardComponent } from './dashboard.component';
4 import { HeroService  } from '../hero.service';
5 import { of } from 'rxjs';
6
7 describe('DashboardComponent', () => {
8   let component: DashboardComponent;
9   let fixture: ComponentFixture<DashboardComponent>;
10
11   beforeEach(async(() => {
12     TestBed.configureTestingModule({
13       declarations: [ DashboardComponent ],
14       providers: [
15         { provide: HeroService, useValue: { getHeroes: () => of([])}}
16       ]
17     })
18     .compileComponents();
19   }));
20
21   beforeEach(() => {
22     fixture = TestBed.createComponent(DashboardComponent);
23     component = fixture.componentInstance;
24     fixture.detectChanges();
25   });
26
27   it('should create', () => {
28     expect(component).toBeTruthy();
29   });
30 });