diff options
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/admin/role-functions/role-functions.component.spec.ts | 22 |
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(); +}) + }); |