1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
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';
9 describe('SecurityComponent', () => {
10 let component: SecurityComponent;
11 let fixture: ComponentFixture<SecurityComponent>;
13 beforeEach(async(() => {
14 TestBed.configureTestingModule({
15 schemas: [CUSTOM_ELEMENTS_SCHEMA],
16 declarations: [ SecurityComponent ],
17 imports: [FormsModule, HttpClientTestingModule]
23 fixture = TestBed.createComponent(SecurityComponent);
24 component = fixture.componentInstance;
25 fixture.detectChanges();
28 it('should create', () => {
29 expect(component).toBeTruthy();
32 it('should test ngOnInit method', () => {
33 component.reportType = "Dashboard";
35 expect(component.showSpinner).toEqual(true);
36 expect(component.stepNo).toEqual('2');
38 component.reportType = "test";
40 expect(component.stepNo).toEqual('6');
43 it('should test addUserEditAccess method', () =>{
44 let reportUserId = 'test';
46 component.userEditAccessArr[1] = true;
47 component.addUserEditAccess(reportUserId, index);
49 component.userEditAccessArr[1] = false;
50 component.addUserEditAccess(reportUserId, index);
54 it('should test addRoleEditAccess method', () =>{
55 let reportUserId = 'test';
57 component.addRoleEditAccessArr[1] = true;
58 component.addRoleEditAccess(reportUserId, index);
60 component.addRoleEditAccessArr[1] = false;
61 component.addRoleEditAccess(reportUserId, index);
65 it("should test addReportUser method", () => {
66 component.addReportUser();
69 it("should test removeReportUser method", () => {
70 component.removeReportUser("test");
73 it("should test addReportRole method", () => {
74 component.addReportRole();
77 it("should test removeReportRole method", () => {
78 component.removeReportRole("test");
81 it("should test saveSecurityTabData method", () => {
82 component.saveSecurityTabData();