11import { TestBed } from '@angular/core/testing' ;
22import { HttpClientTestingModule , HttpTestingController } from '@angular/common/http/testing' ;
3- import { HttpClient } from '@angular/common/http' ;
43import { AppComponent } from './app.component' ;
54
65describe ( 'AppComponent' , ( ) => {
7- let httpClient : HttpClient ;
8- let httpTestingController : HttpTestingController ;
96
107 beforeEach ( async ( ) => {
118 await TestBed . configureTestingModule ( {
@@ -14,8 +11,6 @@ describe('AppComponent', () => {
1411 ] ,
1512 imports : [ HttpClientTestingModule ]
1613 } ) . compileComponents ( ) ;
17- httpClient = TestBed . inject ( HttpClient ) ;
18- httpTestingController = TestBed . inject ( HttpTestingController ) ;
1914 } ) ;
2015
2116 it ( 'should create the app' , ( ) => {
@@ -32,7 +27,7 @@ describe('AppComponent', () => {
3227
3328 it ( 'should render title' , ( ) => {
3429 const fixture = TestBed . createComponent ( AppComponent ) ;
35- const req = httpTestingController . expectOne ( 'resource' ) ;
30+ const req = TestBed . inject ( HttpTestingController ) . expectOne ( 'resource' ) ;
3631 expect ( req . request . method ) . toEqual ( 'GET' ) ;
3732 req . flush ( { "id" : "1234" , "content" : "Hello" } ) ;
3833 fixture . whenRenderingDone ( ) . then (
0 commit comments