diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-03-04 16:46:27 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-03-04 16:46:39 +0530 |
commit | 39cb4ff5d211c5d12b2368f5076d5a927ad74740 (patch) | |
tree | 976c163adba6cb740d72031635a68a578d6d956c /ecomp-sdk/epsdk-app-overlay | |
parent | d1cb62e4628dcc6a445b48de9f618e50e25475f4 (diff) |
testing ngOnInit case for self component
testing ngOnInit in self component
Issue-ID: PORTAL-813
Change-Id: Ib9e9a2819168415d45d9b17872ebdffe6adab247
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay')
-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(); + }) + }) + }); |