summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorRupinder <rupinsi1@in.ibm.com>2020-01-24 14:37:20 +0530
committerRupinder <rupinsi1@in.ibm.com>2020-01-24 14:37:32 +0530
commitf7428eb4b2278d1f8b8922b3d75f788e05ded278 (patch)
treecf1eb7f39ef8d1535f49366c59e6b09240fe800c /ecomp-sdk
parent2ed99c22f062941076e30fb2299fa7274061fdd3 (diff)
Added test case for role-function component
Written 2 test cases for role-function component Issue-ID: PORTAL-808 Change-Id: I57af282383158a27e6127eda3356703f2d2fade5 Signed-off-by: Rupinder <rupinsi1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts22
1 files changed, 19 insertions, 3 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts
index 24396996..a19fd52a 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts
@@ -3,15 +3,19 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RoleFunctionsComponent } from './role-functions.component';
import { AdminService } from '../admin.service';
import { inject } from '@angular/core/testing';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
describe('RoleFunctionsComponent', () => {
let component: RoleFunctionsComponent;
let fixture: ComponentFixture<RoleFunctionsComponent>;
+ let modalService: any;
+ let item: any;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ RoleFunctionsComponent ]
- })
+ declarations: [ RoleFunctionsComponent ],
+ imports: [NgbModal]
+ })
.compileComponents();
}));
@@ -19,14 +23,26 @@ describe('RoleFunctionsComponent', () => {
fixture = TestBed.createComponent(RoleFunctionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ modalService = TestBed.get(NgbModal);
});
it('should create', () => {
expect(component).toBeTruthy();
});
-it('should test getDismissReason function', inject([AdminService],(adminservice) => {
+ it('should test getDismissReason function', inject([AdminService],(adminservice) => {
component.getRoleFunctions();
expect(adminservice.getRoleFunctionsList).toHaveBeenCalled();
}));
+
+ it('should test getDismissReason function to call ngModal.open function', () => {
+ component.delRoleFunction({'label': 'abc'});
+ expect(modalService.open).toHaveBeenCalled();
+ });
+
+ it('should test delRoleFunction function', () => {
+ component.delRoleFunction(item);
+ expect(component.delRoleFunction).toHaveBeenCalled();
+})
+
});