a19fd52af16d314a310c43d36e069186d72e8a1d
[portal/sdk.git] /
1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
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';
7
8 describe('RoleFunctionsComponent', () => {
9   let component: RoleFunctionsComponent;
10   let fixture: ComponentFixture<RoleFunctionsComponent>;
11   let modalService: any;
12   let item: any;
13
14   beforeEach(async(() => {
15     TestBed.configureTestingModule({
16       declarations: [ RoleFunctionsComponent ],
17       imports: [NgbModal]
18     })
19     .compileComponents();
20   }));
21
22   beforeEach(() => {
23     fixture = TestBed.createComponent(RoleFunctionsComponent);
24     component = fixture.componentInstance;
25     fixture.detectChanges();
26     modalService = TestBed.get(NgbModal);
27   });
28
29   it('should create', () => {
30     expect(component).toBeTruthy();
31   });
32
33   it('should test getDismissReason function', inject([AdminService],(adminservice) => {
34     component.getRoleFunctions();
35     expect(adminservice.getRoleFunctionsList).toHaveBeenCalled();
36   }));
37
38   it('should test getDismissReason function to call ngModal.open function', () => {
39     component.delRoleFunction({'label': 'abc'});
40     expect(modalService.open).toHaveBeenCalled();
41   });
42
43   it('should test delRoleFunction function', () => {
44     component.delRoleFunction(item);
45     expect(component.delRoleFunction).toHaveBeenCalled();
46 })
47
48 });