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';
9 describe('RunReportFormFieldsComponent', () => {
10 let component: RunReportFormFieldsComponent;
11 let fixture: ComponentFixture<RunReportFormFieldsComponent>;
13 beforeEach(async(() => {
14 TestBed.configureTestingModule({
15 schemas: [CUSTOM_ELEMENTS_SCHEMA],
16 imports: [FormsModule, MatDatepickerModule, HttpClientTestingModule, RouterTestingModule],
17 declarations: [ RunReportFormFieldsComponent ]
23 fixture = TestBed.createComponent(RunReportFormFieldsComponent);
24 component = fixture.componentInstance;
25 fixture.detectChanges();
28 it('should create', () => {
29 expect(component).toBeTruthy();
32 it('should test ngOnInit method', () => {
34 expect(component.showSpinner).toEqual(true);
35 expect(component.navigateToRun).toEqual(false);
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);
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);
55 it('should test showLabelFn method', () => {
56 component.showLabelFn();
57 expect(component.showLabel).toEqual(component.showLabel);