diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-27 00:05:12 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-27 00:05:12 +0000 |
commit | 5ba20563c01fd76c873d3d1bfb5c6ad44b72f25e (patch) | |
tree | fb0ac7ca160063b50ae7c7c5d26fe94523440253 /ecomp-sdk/epsdk-app-overlay | |
parent | b5a93004d4bc95d18eea61cf06604eece8cee2a7 (diff) | |
parent | e62e0c4031d0573411ea4fbc64170bfd8300b031 (diff) |
Merge "test cases in self component"
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 | 49 |
1 files changed, 46 insertions, 3 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 ee8f7b64..5178b52b 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 @@ -50,18 +50,27 @@ import { UserService } from 'src/app/shared/services/user/user.service'; import { Observable } from 'rxjs'; import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; -import { ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; +import { ModalDismissReasons, NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { ProfileService } from '../profile.service'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; +import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; describe('SelfComponent', () => { let component: SelfComponent; let fixture: ComponentFixture<SelfComponent>; let userService:UserService; + let profileService:ProfileService; let tableobj:any=JSON.stringify({"errormessage":"DummyError","stacktrace":"trace"}); + let data={"data":'{"profile":\'{"data":"data"}\'}'}; + //var _element={"_element":true}; + var _element={"_element":{"selected":true}} + + beforeEach(async(() => { TestBed.configureTestingModule({ schemas: [CUSTOM_ELEMENTS_SCHEMA], - declarations: [ SelfComponent ], + declarations: [ SelfComponent,InformationModalComponent ], imports: [ ReactiveFormsModule, FormsModule, @@ -70,9 +79,15 @@ describe('SelfComponent', () => { MatSlideToggleModule, BrowserAnimationsModule, HttpClientTestingModule, - RouterTestingModule + RouterTestingModule, + NgbModule.forRoot() ] }) + TestBed.overrideModule(BrowserDynamicTestingModule,{ + set:{ + entryComponents:[InformationModalComponent ] + } + }) .compileComponents(); })); @@ -81,12 +96,17 @@ describe('SelfComponent', () => { component = fixture.componentInstance; fixture.detectChanges(); userService=TestBed.get(UserService); + profileService=TestBed.get(ProfileService); }); it('should create', () => { expect(component).toBeTruthy(); }); + // it('should test assignProfileDetails method',()=>{ + // component.assignProfileDetails(data); + // }) + describe('should test ngOnInit method',()=>{ it('should test subscribe',()=>{ let spy=spyOn(userService,'getFunctionalMenuStaticDetailSession').and.returnValue(Observable.of('you object')); @@ -101,4 +121,27 @@ describe('SelfComponent', () => { component['getDismissReason'](""); }) + it('should test getProfileById method',()=>{ + let spy=spyOn(profileService,'getProfileById').and.callThrough(); + component.getProfileById("indrijeet"); + expect(spy).toHaveBeenCalled(); + }) + + it('should test getSelfProfileDetail method',()=>{ + let spy=spyOn(profileService,'getSelfProfile').and.callThrough(); + component.getSelfProfileDetail(); + expect(spy).toHaveBeenCalled(); + }) + + // // it('should test saveProfile method',()=>{ + // // component.saveProfile() + // // }) + + it('should test toggleRoles method',()=>{ + component.ociavailableRoles=[{"ociavailableRoles":"ociavailableRoles"}]; + component.finalSelectedRoles=[{"finalSelectedRoles":"finalSelectedRoles"}]; + component.toggleRoles(_element); + component.addUserRole(_element); + }) + }); |