* See: https://medium.com/netscape/testing-with-the-angular-httpclient-api-
648203820712
* Note: error-handling is not needed here, because the errors
(500 / 404) are handled in the service and the expected result
is already tested.
describe('HeroService', () => {
let service: HeroService;
let httpTestingController: HttpTestingController;
describe('HeroService', () => {
let service: HeroService;
let httpTestingController: HttpTestingController;
- let scheduler: TestScheduler;
beforeEach(() => {
TestBed.configureTestingModule({
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [ HttpClientTestingModule ]
+ imports: [ HttpClientTestingModule ],
+ providers: [ HeroService ]
});
service = TestBed.inject(HeroService);
httpTestingController = TestBed.inject(HttpTestingController);
});
service = TestBed.inject(HeroService);
httpTestingController = TestBed.inject(HttpTestingController);
- scheduler = new TestScheduler(((actual, expected) => {
- expect(actual).toEqual(expected);
- }));