3c3efb92fd9a5b021ebed97fb97a0fe90137c79c
[portal/sdk.git] /
1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
3 import { SecurityComponent } from './security.component';
4 import { FormsModule } from '@angular/forms';
5 import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
6 import { HttpClientTestingModule } from '@angular/common/http/testing';
7 import { componentRefresh } from '@angular/core/src/render3/instructions';
8
9 describe('SecurityComponent', () => {
10   let component: SecurityComponent;
11   let fixture: ComponentFixture<SecurityComponent>;
12
13   beforeEach(async(() => {
14     TestBed.configureTestingModule({
15       schemas: [CUSTOM_ELEMENTS_SCHEMA],
16       declarations: [ SecurityComponent ],
17       imports: [FormsModule, HttpClientTestingModule]
18     })
19     .compileComponents();
20   }));
21
22   beforeEach(() => {
23     fixture = TestBed.createComponent(SecurityComponent);
24     component = fixture.componentInstance;
25     fixture.detectChanges();
26   });
27
28   it('should create', () => {
29     expect(component).toBeTruthy();
30   });
31
32   it('should test ngOnInit method', () => {
33       component.reportType = "Dashboard";
34       component.ngOnInit();
35       expect(component.showSpinner).toEqual(true);
36       expect(component.stepNo).toEqual('2');
37
38       component.reportType = "test";
39       component.ngOnInit();
40       expect(component.stepNo).toEqual('6');
41   });
42
43   it('should test addUserEditAccess method', () =>{
44     let reportUserId = 'test';
45     let index = 1;
46     component.userEditAccessArr[1] = true;
47     component.addUserEditAccess(reportUserId, index);
48
49     component.userEditAccessArr[1] = false;
50     component.addUserEditAccess(reportUserId, index);
51     
52   });
53
54   it('should test addRoleEditAccess method', () =>{
55     let reportUserId = 'test';
56     let index = 1;
57     component.addRoleEditAccessArr[1] = true;
58     component.addRoleEditAccess(reportUserId, index);
59
60     component.addRoleEditAccessArr[1] = false;
61     component.addRoleEditAccess(reportUserId, index);
62     
63   });
64
65   it("should test addReportUser method", () => {
66       component.addReportUser();
67   });
68
69   it("should test removeReportUser method", () => {
70     component.removeReportUser("test");
71   });
72
73   it("should test addReportRole method", () => {
74     component.addReportRole();
75   });
76
77   it("should test removeReportRole method", () => {
78     component.removeReportRole("test");
79   });
80
81   it("should test saveSecurityTabData method", () => {
82     component.saveSecurityTabData();
83   });
84
85 });