6: Get Data from a Server
[examples/angular-tour-of-heroes] / src / app / dashboard / dashboard.component.spec.ts
index 9c996c3..bfadb09 100644 (file)
@@ -1,6 +1,8 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { DashboardComponent } from './dashboard.component';
+import { HeroService  } from '../hero.service';
+import { of } from 'rxjs';
 
 describe('DashboardComponent', () => {
   let component: DashboardComponent;
@@ -8,7 +10,10 @@ describe('DashboardComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ DashboardComponent ]
+      declarations: [ DashboardComponent ],
+      providers: [
+        { provide: HeroService, useValue: { getHeroes: () => of([])}}
+      ]
     })
     .compileComponents();
   }));