diff options
author | Lorraine Welch <lb2391@att.com> | 2020-03-04 14:57:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-04 14:57:14 +0000 |
commit | e7c531d9cd8484a01c6d74218d44a6f654544f68 (patch) | |
tree | abce7f4aad4af407071f7b4b17b9208a212587d7 | |
parent | 46607ab706824f57828c3fc21b9ec094fa66ddf4 (diff) | |
parent | 39cb4ff5d211c5d12b2368f5076d5a927ad74740 (diff) |
Merge "testing ngOnInit case for self component"
-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(); + }) + }) + }); |