summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-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/security/security.component.spec.ts48
-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/header-tabs-component/header-tabs.component.spec.ts7
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts6
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts11
7 files changed, 146 insertions, 54 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/security/security.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
index 5afbea4b..3c3efb92 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
@@ -30,10 +30,56 @@ describe('SecurityComponent', () => {
});
it('should test ngOnInit method', () => {
- component.reportType === "Dashboard";
+ component.reportType = "Dashboard";
component.ngOnInit();
expect(component.showSpinner).toEqual(true);
+ expect(component.stepNo).toEqual('2');
+
+ component.reportType = "test";
+ component.ngOnInit();
expect(component.stepNo).toEqual('6');
});
+ it('should test addUserEditAccess method', () =>{
+ let reportUserId = 'test';
+ let index = 1;
+ component.userEditAccessArr[1] = true;
+ component.addUserEditAccess(reportUserId, index);
+
+ component.userEditAccessArr[1] = false;
+ component.addUserEditAccess(reportUserId, index);
+
+ });
+
+ it('should test addRoleEditAccess method', () =>{
+ let reportUserId = 'test';
+ let index = 1;
+ component.addRoleEditAccessArr[1] = true;
+ component.addRoleEditAccess(reportUserId, index);
+
+ component.addRoleEditAccessArr[1] = false;
+ component.addRoleEditAccess(reportUserId, index);
+
+ });
+
+ it("should test addReportUser method", () => {
+ component.addReportUser();
+ });
+
+ it("should test removeReportUser method", () => {
+ component.removeReportUser("test");
+ });
+
+ it("should test addReportRole method", () => {
+ component.addReportRole();
+ });
+
+ it("should test removeReportRole method", () => {
+ component.removeReportRole("test");
+ });
+
+ it("should test saveSecurityTabData method", () => {
+ component.saveSecurityTabData();
+ });
+
});
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/header-tabs-component/header-tabs.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts
index d297fa06..da392424 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts
@@ -1,6 +1,9 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HeaderTabsComponent } from './header-tabs.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RouterTestingModule } from '@angular/router/testing';
describe('MainComponentComponent', () => {
let component: HeaderTabsComponent;
@@ -8,7 +11,9 @@ describe('MainComponentComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ HeaderTabsComponent ]
+ schemas:[CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ HeaderTabsComponent ],
+ imports:[HttpClientTestingModule,RouterTestingModule]
})
.compileComponents();
}));
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts
index 60f464b8..9cd37313 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts
@@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HeaderTabsWrapperComponent } from './header-tabs-wrapper.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { RouterTestingModule } from '@angular/router/testing';
describe('ReportsComponentComponent', () => {
let component: HeaderTabsWrapperComponent;
@@ -8,7 +10,9 @@ describe('ReportsComponentComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ HeaderTabsWrapperComponent ]
+ declarations: [ HeaderTabsWrapperComponent ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ imports:[RouterTestingModule]
})
.compileComponents();
}));
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