import { ComponentFixture , TestBed , waitForAsync } from '@angular/core/testing' ; import { HttpClientTestingModule } from '@angular/common/http/testing' ; import { of } from 'rxjs' ; import { ProfileInfo } from 'app/layouts/profiles/profile-info.model' ; import { ProfileService } from 'app/layouts/profiles/profile.service' ; import { PageRibbonComponent } from './page-ribbon.component' ; describe ( 'Page Ribbon Component' , ( ) => { let comp ; let fixture ; let profileService ; beforeEach ( waitForAsync ( ( ) => { TestBed . configureTestingModule ( { imports : [ HttpClientTestingModule ] , declarations : [ PageRibbonComponent ] , } ) . overrideTemplate ( PageRibbonComponent , '' ) . compileComponents ( ) ; } ) ) ; beforeEach ( ( ) => { fixture = TestBed . createComponent ( PageRibbonComponent ) ; comp = fixture . componentInstance ; profileService = TestBed . inject ( ProfileService ) ; } ) ; it ( 'Should call profileService.getProfileInfo on init' , ( ) => { jest . spyOn ( profileService , 'getProfileInfo' ) . mockReturnValue ( of ( new ProfileInfo ( ) ) ) ; comp . ngOnInit ( ) ; expect ( profileService . getProfileInfo ) . toHaveBeenCalled ( ) ; } ) ; } ) ;