import { HttpClientTestingModule } from '@angular/common/http/testing' ; import { NO_ERRORS_SCHEMA } from '@angular/core' ; import { TestBed , waitForAsync } from '@angular/core/testing' ; import { AppComponent } from './app.component' ; import { UserService } from './user.service' ; const userServiceStub = { fetchInformation : jasmine . createSpy ( 'userService.fetchInformation' ) , getUserFacebook : jasmine . createSpy ( 'userService.getUserFacebook' ) } ; describe ( 'AppComponent' , ( ) => { beforeEach ( waitForAsync ( ( ) => { TestBed . configureTestingModule ( { declarations : [ AppComponent ] , imports : [ HttpClientTestingModule ] , providers : [ { provide : UserService , use : userServiceStub } ] , schemas : [ NO_ERRORS_SCHEMA ] } ) . compileComponents ( ) ; } ) ) ; it ( 'should create the app' , waitForAsync ( ( ) => { const fixture = TestBed . createComponent ( AppComponent ) ; const app = fixture . debugElement . componentInstance ; expect ( app ) . toBeTruthy ( ) ; } ) ) ; } ) ;