From c2ce800fc99390d95d4cfcce93f597490f6a948b Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 27 Jun 2020 14:37:38 +0200 Subject: [PATCH] Simplified tests for HeroService * 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. --- src/app/hero.service.spec.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/app/hero.service.spec.ts b/src/app/hero.service.spec.ts index 7730d9f..08364db 100644 --- a/src/app/hero.service.spec.ts +++ b/src/app/hero.service.spec.ts @@ -8,17 +8,14 @@ import { Hero } from './hero'; describe('HeroService', () => { let service: HeroService; let httpTestingController: HttpTestingController; - let scheduler: TestScheduler; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ HttpClientTestingModule ] + imports: [ HttpClientTestingModule ], + providers: [ HeroService ] }); service = TestBed.inject(HeroService); httpTestingController = TestBed.inject(HttpTestingController); - scheduler = new TestScheduler(((actual, expected) => { - expect(actual).toEqual(expected); - })); }); afterEach(() => { -- 2.20.1