summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-05-04 13:41:44 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-04 13:41:44 +0000
commitab0b62c2fee1b6bfc6c840b02ad6fb39b7bba14b (patch)
tree73feaeb2efd8e9a0137677736757dc589d9a118c /ecomp-sdk/epsdk-app-overlay/src/main
parent0bc971a79973fbcf19d9c804d37f0c9f44833192 (diff)
parent7b1f8693226c311327d194e1c0e8f6d2a5835697 (diff)
Merge "some test cases in self component"
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts66
1 files changed, 52 insertions, 14 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 5178b52b..52bb01f0 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,29 +48,30 @@ 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;
- 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,InformationModalComponent ],
+ declarations: [
+ SelfComponent,
+ InformationModalComponent,
+ ErrorModalComponent,
+ ConfirmationModalComponent
+ ],
imports: [
ReactiveFormsModule,
FormsModule,
@@ -85,7 +86,10 @@ describe('SelfComponent', () => {
})
TestBed.overrideModule(BrowserDynamicTestingModule,{
set:{
- entryComponents:[InformationModalComponent ]
+ entryComponents:[
+ InformationModalComponent,
+ ErrorModalComponent,
+ ConfirmationModalComponent]
}
})
.compileComponents();
@@ -103,9 +107,6 @@ describe('SelfComponent', () => {
expect(component).toBeTruthy();
});
- // it('should test assignProfileDetails method',()=>{
- // component.assignProfileDetails(data);
- // })
describe('should test ngOnInit method',()=>{
it('should test subscribe',()=>{
@@ -133,9 +134,46 @@ describe('SelfComponent', () => {
expect(spy).toHaveBeenCalled();
})
- // // it('should test saveProfile method',()=>{
- // // component.saveProfile()
- // // })
+ 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"}];