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();
}));
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();
+})
+
});