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;
beforeEach(async(() => {
TestBed.configureTestingModule({
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ imports: [FormsModule, MatDatepickerModule, HttpClientTestingModule, RouterTestingModule],
declarations: [ RunReportFormFieldsComponent ]
})
.compileComponents();
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);
+ });
+
+});
\ No newline at end of file