1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3 import { RoleFunctionsComponent } from './role-functions.component';
4 import { AdminService } from '../admin.service';
5 import { inject } from '@angular/core/testing';
6 import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
8 describe('RoleFunctionsComponent', () => {
9 let component: RoleFunctionsComponent;
10 let fixture: ComponentFixture<RoleFunctionsComponent>;
11 let modalService: any;
14 beforeEach(async(() => {
15 TestBed.configureTestingModule({
16 declarations: [ RoleFunctionsComponent ],
23 fixture = TestBed.createComponent(RoleFunctionsComponent);
24 component = fixture.componentInstance;
25 fixture.detectChanges();
26 modalService = TestBed.get(NgbModal);
29 it('should create', () => {
30 expect(component).toBeTruthy();
33 it('should test getDismissReason function', inject([AdminService],(adminservice) => {
34 component.getRoleFunctions();
35 expect(adminservice.getRoleFunctionsList).toHaveBeenCalled();
38 it('should test getDismissReason function to call ngModal.open function', () => {
39 component.delRoleFunction({'label': 'abc'});
40 expect(modalService.open).toHaveBeenCalled();
43 it('should test delRoleFunction function', () => {
44 component.delRoleFunction(item);
45 expect(component.delRoleFunction).toHaveBeenCalled();