summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
blob: 3c3efb92fd9a5b021ebed97fb97a0fe90137c79c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { SecurityComponent } from './security.component';
import { FormsModule } from '@angular/forms';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { componentRefresh } from '@angular/core/src/render3/instructions';

describe('SecurityComponent', () => {
  let component: SecurityComponent;
  let fixture: ComponentFixture<SecurityComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      schemas: [CUSTOM_ELEMENTS_SCHEMA],
      declarations: [ SecurityComponent ],
      imports: [FormsModule, HttpClientTestingModule]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(SecurityComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });

  it('should test ngOnInit method', () => {
      component.reportType = "Dashboard";
      component.ngOnInit();
      expect(component.showSpinner).toEqual(true);
      expect(component.stepNo).toEqual('2');

      component.reportType = "test";
      component.ngOnInit();
      expect(component.stepNo).toEqual('6');
  });

  it('should test addUserEditAccess method', () =>{
    let reportUserId = 'test';
    let index = 1;
    component.userEditAccessArr[1] = true;
    component.addUserEditAccess(reportUserId, index);

    component.userEditAccessArr[1] = false;
    component.addUserEditAccess(reportUserId, index);
    
  });

  it('should test addRoleEditAccess method', () =>{
    let reportUserId = 'test';
    let index = 1;
    component.addRoleEditAccessArr[1] = true;
    component.addRoleEditAccess(reportUserId, index);

    component.addRoleEditAccessArr[1] = false;
    component.addRoleEditAccess(reportUserId, index);
    
  });

  it("should test addReportUser method", () => {
      component.addReportUser();
  });

  it("should test removeReportUser method", () => {
    component.removeReportUser("test");
  });

  it("should test addReportRole method", () => {
    component.addReportRole();
  });

  it("should test removeReportRole method", () => {
    component.removeReportRole("test");
  });

  it("should test saveSecurityTabData method", () => {
    component.saveSecurityTabData();
  });

});