summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts
blob: d693ebc0635bc953e200d8265cd197c05e0ef86c (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
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {FormsModule} from '@angular/forms';
import { RunReportFormFieldsComponent } from './run-report-form-fields.component';
import { CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
import {MatDatepickerModule} from '@angular/material/datepicker'; 
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';

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

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

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

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

  it('should test ngOnInit method', () => {
        component.ngOnInit();
        expect(component.showSpinner).toEqual(true);
        expect(component.navigateToRun).toEqual(false);
  });

  it('should test getQueryString method', () => {
    component.directCallQueryParams !== '';    
    component.getQueryString();
    expect(component.getQueryString()).toEqual(component.directCallQueryParams);
    component.directCallQueryParams == '';    
    component.getQueryString();
    expect(component.getQueryString()).toEqual(component.queryString);
  });

  it('should test showError method', () => {
      component.showError('test');
      expect(component.errorMessage).toEqual('test'['errormessage']);
      expect(component.stackTrace).toEqual('test'['stacktrace']);
      expect(component.error).toEqual(true);
      expect(component.showSpinner).toEqual(false);
  });

  it('should test showLabelFn method', () => {
    component.showLabelFn();
    expect(component.showLabel).toEqual(component.showLabel);
  });

});