summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-04-27 00:07:49 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-27 00:07:49 +0000
commitda7f81c50c38739f63763eb4c5b6ad4156b1706f (patch)
treedce19e5966a9e7e7bf13a791d6ea82d448ffc664 /ecomp-sdk
parent6ac1264e5f1ce5188ad05691588fc8a2747c12e7 (diff)
parent419d3fae58a47fad5ff42692d693d89e8fe305fc (diff)
Merge "some test cases in new-role component"
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts53
1 files changed, 48 insertions, 5 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
index 8a30f2a3..d03cf4a6 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
@@ -47,19 +47,30 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
+import { AdminService } from '../../admin.service';
+import { Observable } from 'rxjs';
+import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
describe('NewRoleComponent', () => {
let component: NewRoleComponent;
let fixture: ComponentFixture<NewRoleComponent>;
let role1 = "";
+ let adminService:AdminService;
+ var _element={
+ "selected":false,
+ "code":"code",
+ "type":"type",
+ "action":"action"
+ };
beforeEach(async(() => {
TestBed.configureTestingModule({
- providers: [NgbActiveModal],
+ providers: [NgbActiveModal,AdminService],
schemas: [CUSTOM_ELEMENTS_SCHEMA] ,
declarations: [
NewRoleComponent,
- ConfirmationModalComponent
+ ConfirmationModalComponent,
+ InformationModalComponent
],
imports: [
FormsModule,
@@ -70,7 +81,7 @@ describe('NewRoleComponent', () => {
})
TestBed.overrideModule(BrowserDynamicTestingModule,{
set:{
- entryComponents:[ConfirmationModalComponent]
+ entryComponents:[ConfirmationModalComponent,InformationModalComponent]
}
})
.compileComponents();
@@ -81,15 +92,45 @@ describe('NewRoleComponent', () => {
component = fixture.componentInstance;
component.role = role1;
fixture.detectChanges();
+ adminService=TestBed.get(AdminService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+ // it('should test ngOnInit method',()=>{
+ // component.isEditMode=true;
+ // component.ociavailableRoleFunctions="tndrijeet";
+ // //component.ociavailableRoleFunctions.length=9;
+ // component.ngOnInit();
+ // })
+
+ // it('should test setSelectedRoleFucntions method',()=>{
+ // component.ociavailableRoleFunctions.length={"selected":false};
+ // component.setSelectedRoleFucntions("i");
+ // })
+
+ it('should test delRoleFunctionConfirmPopUp method',()=>{
+ component.delRoleFunctionConfirmPopUp("indrijeet","kumar");
+ })
+
+ // it('should test if condition in saveChanges method',()=>{
+ // component.isEditMode=true;
+ // //spyOn(adminService,'saveRole').and.returnValue(Observable.of('your object'));
+ // component.saveChanges()
+ // })
+
+ it('should test else condition in saveChanges method',()=>{
+ spyOn(adminService,'saveRole').and.returnValue(Observable.of('your object'));
+ component.saveChanges()
+ })
+
it('should test toggleRoleFunction method',()=>{
- component.ociavailableRoleFunctions=1;
- component.toggleRoleFunction("toggleRoleFunction")
+ component.finalSelectedRoleFunctions="Indrijeet kumar";
+ component.ociavailableRoleFunctions="i";
+ component.finalSelectedRoleFunctions="k";
+ component.toggleRoleFunction(_element)
})
it('should test populateTableData method',()=>{
@@ -99,6 +140,8 @@ describe('NewRoleComponent', () => {
})
it('should test isRoleAlreadyExist method',()=>{
+ // component.availableRoles={"name":"currentRoleName"};
+ component.availableRoles={"name":["currentRoleName"]};
component.isRoleAlreadyExist("currentRoleName")
})