diff options
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts index d87afceb..7481acc8 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts @@ -46,10 +46,14 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { MatTableModule, MatSelectModule, MatSlideToggleModule } from '@angular/material'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { UserService } from 'src/app/shared/services/user/user.service'; +import { Observable } from 'rxjs'; describe('SelfComponent', () => { let component: SelfComponent; let fixture: ComponentFixture<SelfComponent>; + let userService:UserService; + let tableobj:any=JSON.stringify({"errormessage":"DummyError","stacktrace":"trace"}); beforeEach(async(() => { TestBed.configureTestingModule({ @@ -72,9 +76,19 @@ describe('SelfComponent', () => { fixture = TestBed.createComponent(SelfComponent); component = fixture.componentInstance; fixture.detectChanges(); + userService=TestBed.get(UserService); }); it('should create', () => { expect(component).toBeTruthy(); }); + + describe('should test ngOnInit method',()=>{ + it('should test subscribe',()=>{ + let spy=spyOn(userService,'getFunctionalMenuStaticDetailSession').and.returnValue(Observable.of('you object')); + component.ngOnInit(); + expect(spy).toHaveBeenCalled(); + }) + }) + }); |