d693ebc0635bc953e200d8265cd197c05e0ef86c
[portal/sdk.git] /
1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 import {FormsModule} from '@angular/forms';
3 import { RunReportFormFieldsComponent } from './run-report-form-fields.component';
4 import { CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
5 import {MatDatepickerModule} from '@angular/material/datepicker'; 
6 import { HttpClientTestingModule } from '@angular/common/http/testing';
7 import { RouterTestingModule } from '@angular/router/testing';
8
9 describe('RunReportFormFieldsComponent', () => {
10   let component: RunReportFormFieldsComponent;
11   let fixture: ComponentFixture<RunReportFormFieldsComponent>;
12
13   beforeEach(async(() => {
14     TestBed.configureTestingModule({
15       schemas: [CUSTOM_ELEMENTS_SCHEMA],
16       imports: [FormsModule, MatDatepickerModule, HttpClientTestingModule, RouterTestingModule],
17       declarations: [ RunReportFormFieldsComponent ]
18     })
19     .compileComponents();
20   }));
21
22   beforeEach(() => {
23     fixture = TestBed.createComponent(RunReportFormFieldsComponent);
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.ngOnInit();
34         expect(component.showSpinner).toEqual(true);
35         expect(component.navigateToRun).toEqual(false);
36   });
37
38   it('should test getQueryString method', () => {
39     component.directCallQueryParams !== '';    
40     component.getQueryString();
41     expect(component.getQueryString()).toEqual(component.directCallQueryParams);
42     component.directCallQueryParams == '';    
43     component.getQueryString();
44     expect(component.getQueryString()).toEqual(component.queryString);
45   });
46
47   it('should test showError method', () => {
48       component.showError('test');
49       expect(component.errorMessage).toEqual('test'['errormessage']);
50       expect(component.stackTrace).toEqual('test'['stacktrace']);
51       expect(component.error).toEqual(true);
52       expect(component.showSpinner).toEqual(false);
53   });
54
55   it('should test showLabelFn method', () => {
56     component.showLabelFn();
57     expect(component.showLabel).toEqual(component.showLabel);
58   });
59
60 });