summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src
diff options
context:
space:
mode:
authorRupinder <rupinsi1@in.ibm.com>2020-04-01 21:40:27 +0530
committerRupinder <rupinsi1@in.ibm.com>2020-04-01 21:40:31 +0530
commitb2569d001f2bfa0b18d5e88c9c9e95b7326cc616 (patch)
tree3c38276da34d1cf74e548ebbdb408d87aecd9609 /ecomp-sdk/epsdk-app-overlay/src
parent20c95c7edd0861504b50cd86a65ce888b1c6efa6 (diff)
added test case for run-report-form-fields
Wrote test case for run-report-form-fields.component.spec.ts Issue-ID: PORTAL-834 Change-Id: I5ad798cbb9f853d0cbc7d6080b479f2f2f4e9fbf Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src')
-rw-r--r--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.ts50
1 files changed, 37 insertions, 13 deletions
diff --git a/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 b/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
index c922b359..a1906c85 100644
--- a/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
+++ b/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
@@ -5,19 +5,37 @@ 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';
+import { RunService } from '../run.service';
+import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import { of } from 'rxjs';
describe('RunReportFormFieldsComponent', () => {
let component: RunReportFormFieldsComponent;
let fixture: ComponentFixture<RunReportFormFieldsComponent>;
let formfield =[{"validationType":1},{},{}] ;
+ let runService: RunService;
+ let environment = [
+ {
+ baseUrl: 'just for testing'
+ }
+ ]
beforeEach(async(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [FormsModule, MatDatepickerModule, HttpClientTestingModule, RouterTestingModule],
- declarations: [ RunReportFormFieldsComponent ]
+ declarations: [ RunReportFormFieldsComponent ],
+ providers: [RunService]
})
.compileComponents();
+ runService = TestBed.get(RunService);
+ // spyOn(runService, 'getReportData').and.returnValue(Observable.of(environment));
+ // spyOn(runService, 'getReportDataWithFormFields').and.returnValue(Observable.of(environment));
+ spyOn(runService, 'getDefinitionPageDetails').and.returnValue(Observable.of(environment));
+ spyOn(runService, 'refreshFormFields').and.returnValue(Observable.of(environment));
+ // spyOn(runService, 'downloadReportExcel').and.returnValue(Observable.of(environment));
+ spyOn(runService, 'getFormFieldGroupsData').and.returnValue(Observable.of(environment));
}));
beforeEach(() => {
@@ -31,12 +49,6 @@ describe('RunReportFormFieldsComponent', () => {
expect(component).toBeTruthy();
});
- it('should test ngOnInit method', () => {
- component.ngOnInit();
- // expect(component.showSpinner).toEqual(true);
- // expect(component.navigateToRun).toEqual(false);
- });
-
it('should test convertDate method', () => {
component.convertDate("test");
});
@@ -98,16 +110,28 @@ describe('RunReportFormFieldsComponent', () => {
component.formFieldList != undefined;
component.oldGroupSelectValue = "test";
component.groupSelectValue = "testing";
+ // component.toggleFormFieldRenderArr.length = 1;
+ spyOn(component, 'ngDoCheck').and.callThrough();
component.ngDoCheck();
-
+ expect(component.ngDoCheck).toHaveBeenCalled();
expect(component.oldGroupSelectValue).toBe(component.groupSelectValue);
});
- it('should test fetchAndPopulateFormFields method', () => {
- component.fetchAndPopulateFormFields(1, "test");
- })
-
it('should test generateQueryString method',() => {
component.generateQueryString();
- })
+ })
+
+ it('should test ngOnInit method', () => {
+ spyOn(component, 'ngOnInit').and.callThrough();
+ component.ngOnInit();
+ expect(component.ngOnInit).toHaveBeenCalled();
+ });
+
+// it('should test fetchAndPopulateFormFields method', () => {
+// spyOn(component, 'fetchAndPopulateFormFields').and.callThrough();
+// component.formFieldGroupObjList = null;
+// component.fetchAndPopulateFormFields(1, "test");
+// expect(component.fetchAndPopulateFormFields).toHaveBeenCalled();
+// });
+
}); \ No newline at end of file