summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts98
1 files changed, 5 insertions, 93 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 52bb01f0..97e164df 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
@@ -48,30 +48,19 @@ 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';
+import { ActivatedRoute } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
-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';
-import { ErrorModalComponent } from 'src/app/modals/error-modal/error-modal.component';
-import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
describe('SelfComponent', () => {
let component: SelfComponent;
let fixture: ComponentFixture<SelfComponent>;
let userService:UserService;
- let profileService:ProfileService;
- var _element={"_element":{"selected":true}}
-
+ let tableobj:any=JSON.stringify({"errormessage":"DummyError","stacktrace":"trace"});
+
beforeEach(async(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
- declarations: [
- SelfComponent,
- InformationModalComponent,
- ErrorModalComponent,
- ConfirmationModalComponent
- ],
+ declarations: [ SelfComponent ],
imports: [
ReactiveFormsModule,
FormsModule,
@@ -80,18 +69,9 @@ describe('SelfComponent', () => {
MatSlideToggleModule,
BrowserAnimationsModule,
HttpClientTestingModule,
- RouterTestingModule,
- NgbModule.forRoot()
+ RouterTestingModule
]
})
- TestBed.overrideModule(BrowserDynamicTestingModule,{
- set:{
- entryComponents:[
- InformationModalComponent,
- ErrorModalComponent,
- ConfirmationModalComponent]
- }
- })
.compileComponents();
}));
@@ -100,14 +80,12 @@ describe('SelfComponent', () => {
component = fixture.componentInstance;
fixture.detectChanges();
userService=TestBed.get(UserService);
- profileService=TestBed.get(ProfileService);
});
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'));
@@ -116,70 +94,4 @@ describe('SelfComponent', () => {
})
})
- it('should test getDismissReason method',()=>{
- component['getDismissReason'](ModalDismissReasons.ESC);
- component['getDismissReason'](ModalDismissReasons.BACKDROP_CLICK);
- 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 first if condition',()=>{
- component.oriProfile={"loginId":"loginId1"};
- component.profile.loginId="loginId2";
- component.saveProfile()
- })
-
- it('should test saveProfile method second if condition',()=>{
- component.oriProfile={
- "loginId":"loginId",
- "loginPwd":"loginPwd1"
- };
- component.profile.loginId="loginId";
- component.profile.loginPwd="loginPwd2"
- component.saveProfile()
- })
-
- it('should test saveProfile method',()=>{
- component.oriProfile={
- "loginId":"loginId",
- "loginPwd":"loginPwd"
- };
- component.profile.loginId="loginId";
- component.profile.loginPwd="loginPwd";
- component.stateList=[{"value":"value"}];
- component.profile.state="value";
- component.ociCountries=[{"value":"India"}];
- component.profile.country="India";
- component.ociTimeZones=[{"value":"Indian"}];
- component.profile.timeZoneId="Indian";
- component.postData={
- profile: "profile",
- selectedCountry:"selectedCountry",
- selectedState:"selectedState",
- selectedTimeZone:"selectedTimeZone"
- };
- component.profileId="profileId";
- let spy= spyOn(profileService,'saveProfile').and.returnValue(Observable.of('your object'));
- component.saveProfile()
- expect(spy).toHaveBeenCalled();
- });
-
- it('should test toggleRoles method',()=>{
- component.ociavailableRoles=[{"ociavailableRoles":"ociavailableRoles"}];
- component.finalSelectedRoles=[{"finalSelectedRoles":"finalSelectedRoles"}];
- component.toggleRoles(_element);
- component.addUserRole(_element);
- })
-
});