summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src
diff options
context:
space:
mode:
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.ts63
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts6
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts59
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts11
4 files changed, 88 insertions, 51 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 d693ebc0..c922b359 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
@@ -9,6 +9,7 @@ import { RouterTestingModule } from '@angular/router/testing';
describe('RunReportFormFieldsComponent', () => {
let component: RunReportFormFieldsComponent;
let fixture: ComponentFixture<RunReportFormFieldsComponent>;
+ let formfield =[{"validationType":1},{},{}] ;
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -22,6 +23,7 @@ describe('RunReportFormFieldsComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(RunReportFormFieldsComponent);
component = fixture.componentInstance;
+ component.formFieldList = formfield;
fixture.detectChanges();
});
@@ -31,15 +33,20 @@ describe('RunReportFormFieldsComponent', () => {
it('should test ngOnInit method', () => {
component.ngOnInit();
- expect(component.showSpinner).toEqual(true);
- expect(component.navigateToRun).toEqual(false);
+ // expect(component.showSpinner).toEqual(true);
+ // expect(component.navigateToRun).toEqual(false);
});
- it('should test getQueryString method', () => {
- component.directCallQueryParams !== '';
+ it('should test convertDate method', () => {
+ component.convertDate("test");
+ });
+
+ it('should test getQueryString methods', () => {
+ component.directCallQueryParams = 'abc';
component.getQueryString();
expect(component.getQueryString()).toEqual(component.directCallQueryParams);
- component.directCallQueryParams == '';
+
+ component.directCallQueryParams = "";
component.getQueryString();
expect(component.getQueryString()).toEqual(component.queryString);
});
@@ -57,4 +64,50 @@ describe('RunReportFormFieldsComponent', () => {
expect(component.showLabel).toEqual(component.showLabel);
});
+ it('should test editReport method', () => {
+ component.editReport("test");
+ });
+
+ it('should test runReport method', () => {
+ component.iSDashboardReport = "test";
+ component.formFieldList.length = 1;
+ component.runReport();
+
+ expect(component.hitCnt).toBe(component.hitCnt++);
+ expect(component.reportMode).toBe("FormField");
+ let spy = spyOn(component, 'generateQueryString');
+ component.generateQueryString();
+ expect(component.generateQueryString).toHaveBeenCalled();
+ expect(component.showSpinner).toBe(false);
+
+ component.iSDashboardReport = "test";
+ component.formFieldList.length = 0;
+ component.runReport();
+
+ expect(component.reportMode).toBe("Regular");
+
+ component.iSDashboardReport = "Dashboard";
+ component.runReport();
+ expect(component.showSpinner).toBe(false);
+ expect(component.navigateToRun).toBe(true);
+
+
+ });
+
+ it('should test ngDoCheck method', () =>{
+ component.formFieldList != undefined;
+ component.oldGroupSelectValue = "test";
+ component.groupSelectValue = "testing";
+ component.ngDoCheck();
+
+ expect(component.oldGroupSelectValue).toBe(component.groupSelectValue);
+ });
+
+ it('should test fetchAndPopulateFormFields method', () => {
+ component.fetchAndPopulateFormFields(1, "test");
+ })
+
+ it('should test generateQueryString method',() => {
+ component.generateQueryString();
+ })
}); \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts
index 82eda851..3aa4713f 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts
@@ -27,8 +27,12 @@ describe('RunComponent', () => {
});
it('should test ngOnInit method', () => {
+ component.reportType = "Dashboard";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("4");
+
+ component.reportType = "test";
component.ngOnInit();
- component.reportType !== "Dashboard";
expect(component.stepNo).toEqual("8");
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
index 795afc25..c894bff6 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
@@ -6,8 +6,10 @@ import { FormsModule } from '@angular/forms';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { SqlService } from './sql.service';
-import { Observable, of } from 'rxjs';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs/Observable';
import { element } from '@angular/core/src/render3';
+import { environment } from 'src/environments/environment';
describe('SQLComponentComponent', () => {
let sqlService: SqlService;
@@ -43,45 +45,23 @@ describe('SQLComponentComponent', () => {
});
it('should test ngOnInit method', () => {
-
- fixture.detectChanges();
component.ngOnInit();
expect(component.showSaveSQLDialog).toEqual(false);
expect(component.SQLPostResponse).toEqual(true);
expect(component.ValidatePostResponse).toEqual({});
-
- (done: DoneFn)=> {
- sqlService.getSQLTabData("test").subscribe(value => {
- expect(component.showSpinner).toEqual(true);
- expect(component.finalGetObj).toEqual(value);
- expect(component.sqlText).toEqual(component.finalGetObj.query);
- expect(component.showSpinner).toEqual(false);
- done();
- })
- }
-
});
- it('should test ngOnChanges method', () => {
+ it('should test ngOnChanges methods', () => {
fixture.detectChanges();
component.ngOnChanges();
expect(component.showSaveSQLDialog).toEqual(false);
expect(component.SQLPostResponse).toEqual(true);
expect(component.ValidatePostResponse).toEqual({});
-
- sqlService.getSQLTabData("test").subscribe((response) => {
- expect(component.showSpinner).toBe(true);
- expect(component.finalGetObj).toBe(response);
- expect(component.sqlText).toEqual(component.finalGetObj.query);
- expect(component.showSpinner).toEqual(false);
-
- });
-
});
- it('should test saveSQL method', () => {
- component.SQLPostResponse === true;
+ it('should test saveSQL methods if condition', () => {
+ component.SQLPostResponse = true;
component.saveSQL();
expect(component.SQLstatus).toEqual("Success!");
expect(component.SQLmessage).toEqual("Your change has been saved! Definition is updated.");
@@ -90,21 +70,7 @@ describe('SQLComponentComponent', () => {
});
it('should test validate method', () => {
-
- component.validate();
-
- sqlService.postSQLValidateAndSave("test").subscribe((Response) => {
- expect(component.showSpinner).toEqual(true);
- expect(component.ValidateResponseString).toEqual(Response["data"]["elements"]);
- expect(component.ValidatePostResponse).toEqual(JSON.parse(Response["data"]["elements"]));
-
- component.ValidatePostResponse["query"] !== undefined;
-
- expect(component.showModal).toEqual(true);
- expect(component.Validatestatus).toEqual("SQL Test Run - Executed!");
- expect(component.showValidateSQLDialog).toEqual(component.showValidateSQLDialog);
- expect(component.Validateclosable).toEqual(true);
- })
+ component.validate();
});
it('should test closeSaveModal method', () => {
@@ -114,13 +80,18 @@ describe('SQLComponentComponent', () => {
});
it('should test closeValidateModal method', () => {
- component.reportMode === "Create";
- component.Validatestatus == "SQL Test Run - Failed!";
-
+ component.reportMode = "Create";
+ component.Validatestatus = "SQL Test Run - Failed!";
component.closeValidateModal();
expect(component.sqlText).toEqual(component.sqlText);
expect(component.showValidateSQLDialog).toEqual(component.showValidateSQLDialog);
expect(component.Validateclosable).toEqual(false);
+
+ component.reportMode = "Create";
+ component.Validatestatus = "SQL Test Run - Passed!";
+ component.closeValidateModal();
+ expect(component.showValidateSQLDialog).toEqual(component.showValidateSQLDialog);
+ expect(component.Validateclosable).toEqual(false);
});
it('should test SetValidateResponseString method', () => {
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts
index 359bee9f..2c01ff14 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts
@@ -93,5 +93,14 @@ describe('ReportListComponent', () => {
component.close();
expect(component.showDialog).toEqual(true);
expect(component.closable).toEqual(false);
- })
+ });
+
+ it('should test deleteReport method', () => {
+ component.deleteReport();
+ });
+
+ it('should test openReportSchedule method', () => {
+ component.openReportSchedule("test");
+ });
+
}); \ No newline at end of file