summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay
diff options
context:
space:
mode:
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.ts49
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);
+ })
+
});