summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts23
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts15
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts33
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.service.spec.ts18
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/data-chart/data-chart.component.spec.ts4
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts12
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.service.spec.ts32
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts135
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.service.spec.ts70
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts37
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.service.spec.ts21
-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.ts92
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.html2
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts9
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/dashboard-report.service.spec.ts27
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/run-dashboard-report.component.spec.ts115
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts130
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts16
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.spec.ts49
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts62
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.service.spec.ts94
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts4
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts84
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.service.spec.ts27
24 files changed, 1058 insertions, 53 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts
index a4364cc5..6d6e9431 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts
@@ -1,29 +1,35 @@
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
+import { ColumnListComponent } from './column-list.component';
+import { FormsModule } from '@angular/forms';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { DataTableComponent } from './data-table.component';
-
-describe('DataTableComponent', () => {
- let component: DataTableComponent;
- let fixture: ComponentFixture<DataTableComponent>;
+describe('ColumnListComponent', () => {
+ let component: ColumnListComponent;
+ let fixture: ComponentFixture<ColumnListComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ DataTableComponent ],
+ declarations: [ ColumnListComponent ],
imports: [
NoopAnimationsModule,
MatPaginatorModule,
MatSortModule,
MatTableModule,
- ]
+ FormsModule,
+ HttpClientTestingModule
+ ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(DataTableComponent);
+ fixture = TestBed.createComponent(ColumnListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
@@ -31,4 +37,5 @@ describe('DataTableComponent', () => {
it('should compile', () => {
expect(component).toBeTruthy();
});
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts
index ad5f13fe..957be88b 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts
@@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditDrillDownLinkComponent } from './edit-drill-down-link.component';
+import { FormsModule } from '@angular/forms';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('EditDrillDownLinkComponent', () => {
let component: EditDrillDownLinkComponent;
@@ -8,7 +10,11 @@ describe('EditDrillDownLinkComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ EditDrillDownLinkComponent ]
+ declarations: [ EditDrillDownLinkComponent ],
+ imports:[
+ FormsModule,
+ HttpClientTestingModule
+ ]
})
.compileComponents();
}));
@@ -17,9 +23,4 @@ describe('EditDrillDownLinkComponent', () => {
fixture = TestBed.createComponent(EditDrillDownLinkComponent);
component = fixture.componentInstance;
fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
+ }); \ 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/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts
index 5cd70a7c..6d0c2946 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts
@@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
+import { FormsModule } from '@angular/forms';
import { DashboardReportGridComponent } from './dashboard-report-grid.component';
+import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('DashboardReportGridComponent', () => {
let component: DashboardReportGridComponent;
@@ -8,10 +10,12 @@ describe('DashboardReportGridComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ DashboardReportGridComponent ]
+ schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
+ declarations: [ DashboardReportGridComponent ],
+ imports: [FormsModule, HttpClientTestingModule]
})
.compileComponents();
- }));
+ }));
beforeEach(() => {
fixture = TestBed.createComponent(DashboardReportGridComponent);
@@ -22,4 +26,25 @@ describe('DashboardReportGridComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
-});
+
+ it('should test ngOnInit method', () => {
+ component.ngOnInit();
+ });
+
+ it('should test changedOption method', () => {
+ component.changedOptions();
+ });
+
+ it('should test assignCopy method', () => {
+ component.assignCopy();
+ });
+
+ it('should test filterItem method', () => {
+ component.filterItem(1);
+ });
+
+ it('should test addItem method', () => {
+ component.addItem();
+ });
+
+}); \ 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/definition/dashboard-report-grid/dashboard-report-grid.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.service.spec.ts
index 72d0980d..f8611463 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.service.spec.ts
@@ -1,12 +1,28 @@
import { TestBed } from '@angular/core/testing';
import { DashboardReportGridService } from './dashboard-report-grid.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { environment } from 'src/environments/environment';
describe('DashboardReportGridService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+
+ let service: DashboardReportGridService;
+
+ beforeEach(() => {TestBed.configureTestingModule({
+ imports: [HttpClientTestingModule]
+ });
+ service = TestBed.get(DashboardReportGridService);
+
+});
it('should be created', () => {
const service: DashboardReportGridService = TestBed.get(DashboardReportGridService);
expect(service).toBeTruthy();
});
+
+ it('should getReportList', () => {
+ service.getReportList().subscribe((res) => {
+ expect(res).toBe(environment);
+ })
+ })
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/data-chart/data-chart.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/data-chart/data-chart.component.spec.ts
index ea0912b2..2c67d5d7 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/data-chart/data-chart.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/data-chart/data-chart.component.spec.ts
@@ -29,4 +29,8 @@ describe('DataChartComponent', () => {
it('should compile', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit method',()=>{
+ expect(component.dataSource).toBeDefined();
+ })
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts
index 26e51d34..e137dfd6 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts
@@ -1,6 +1,10 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DefinitionComponent } from './definition.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
describe('PilotPageComponent', () => {
let component: DefinitionComponent;
@@ -8,7 +12,13 @@ describe('PilotPageComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ DefinitionComponent ]
+ schemas:[CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ DefinitionComponent ],
+ imports:[
+ FormsModule,
+ HttpClientTestingModule,
+ RouterTestingModule
+ ]
})
.compileComponents();
}));
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.service.spec.ts
index 1c56d381..74dc8b5e 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.service.spec.ts
@@ -2,15 +2,41 @@ import { TestBed } from '@angular/core/testing';
import { DefinitionService } from './definition.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
describe('DefinitionServiceService', () => {
- beforeEach(() =>
+
+let service:DefinitionService;
+
+ beforeEach(() =>{
TestBed.configureTestingModule({
- imports: [HttpClientTestingModule]
- }));
+ imports: [HttpClientTestingModule],
+ providers:[HttpClientModule,DefinitionService]
+ })
+ service=TestBed.get(DefinitionService);
+});
it('should be created', () => {
const service: DefinitionService = TestBed.get(DefinitionService);
expect(service).toBeTruthy();
});
+
+ it('should get getDefinitionPageDetails', () => {
+ let IncomingReportId : number;
+ let reportMode: string;
+ service.getDefinitionPageDetails(IncomingReportId,reportMode).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl+IncomingReportId);
+ });
+ })
+
+ it('should get portDefinitionPageDetails', () => {
+ let IncomingReportId: number;
+ let finalPostObj : any;
+ service.portDefinitionPageDetails(IncomingReportId,finalPostObj).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl+IncomingReportId);
+ });
+ })
+
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
index 42544a72..8d9003fc 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
@@ -1,6 +1,12 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FormFieldsComponent } from './form-fields.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { MatDialogModule, MatSnackBarModule } from '@angular/material';
+import { CommonModule } from '@angular/common';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('FormFieldsComponent', () => {
let component: FormFieldsComponent;
@@ -8,7 +14,15 @@ describe('FormFieldsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ FormFieldsComponent ]
+ schemas:[CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ FormFieldsComponent ],
+ imports:[
+ FormsModule,
+ HttpClientTestingModule,
+ MatDialogModule,
+ MatSnackBarModule,
+ // BrowserAnimationsModule
+ ]
})
.compileComponents();
}));
@@ -22,4 +36,123 @@ describe('FormFieldsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test isFirst method',()=>{
+ expect(component.isFirst(0)).toBe(true);
+ expect(component.isFirst(2)).toBe(false);
+ });
+
+ it('should test isLast method', () =>{
+ component.formFieldsListObj.length = 12;
+ expect(component.isLast(15)).toEqual(false);
+ });
+
+ it('should test ngDoCheck method',()=>{
+ component.sqlAsDefaultValue=true;
+ if(component.sqlAsDefaultValue==true){
+ expect(component.showDefaultSQLOption).toBe(false);
+ }
+ else{
+ expect(component.showDefaultSQLOption).toBe(true);
+ }
+ });
+
+ it('should test setDisplayMode method',()=>{
+ component.setDisplayMode("setDisplayMode");
+ });
+
+ it('should test edit method',()=>{
+ component.edit("Id");
+
+ })
+
+ it('should test add method',()=>{
+ component.add();
+ expect(component.showDialog).toBe(true);
+ expect(component.closable).toBe(true);
+ expect(component.validationType).toEqual("");
+ expect(component.visible).toEqual("YES");
+ expect(component.message).toBe("");
+ expect(component.groupFormField).toBe(false);
+ expect(component.fieldType).toBe("");
+ expect(component.fieldSQL).toBe("");
+ expect(component.fieldName).toBe("");
+ expect(component.fieldId).toBe("");
+ expect(component.fieldDefaultSQL).toBe('');
+ expect(component.errorStackTrace).toBe("");
+ expect(component.errorMessage).toBe("");
+ expect(component.defaultValue).toBe(false);
+ expect(component.predefinedValueList).toEqual([]);
+ expect(component.showDialog).toBe(true);
+ expect(component.closable).toBe(true);
+ expect(component.mode).toEqual("Add");
+ });
+
+ it('should test close method1',()=>{
+ component.showDialog=true;
+ component.close();
+ expect(component.showDialog).toBe(false);
+ expect(component.closable).toBe(false);
+ });
+
+ it('should test close method2',()=>{
+ component.showDialog=false;
+ component.close();
+ expect(component.showDialog).toBe(true);
+ expect(component.closable).toBe(false);
+});
+
+ it('should test loseValidateModal method1',()=>{
+ component.showDialog1=true;
+ component.closeValidateModal();
+ expect(component.showDialog1).toBe(false);
+ expect(component.showVerifySpinner).toBe(false);
+ })
+
+ it('should test loseValidateModal method2',()=>{
+ component.showDialog1=false;
+ component.closeValidateModal();
+ expect(component.showDialog1).toBe(true);
+ expect(component.showVerifySpinner).toBe(false);
+});
+
+it('should test addToList method',()=>{
+ component.addToList("attrib")
+ {
+ expect(component.predefinedValueList.pop()).toEqual({id:'attrib', name:'attrib',selected:false});
+ }
+});
+
+it('should test deleteFromList method',()=>{
+component.deleteFromList("attrib");
+});
+
+it('should test save method',()=>{
+ component.save();
+ expect(component.showSpinner).toBe(true);
+ expect(component.showDialog).toBe(false);
+ expect(component.finalPOSTObj["validationType"]).toEqual(component.validationType);
+ if(component.visible=="YES")
+ expect(component.finalPOSTObj["visible"]).toBe(true);
+ else
+ expect(component.finalPOSTObj["visible"]).toBe(false);
+ expect(component.finalPOSTObj["orderSeq"]).toEqual(component.orderSeq);
+ expect(component.finalPOSTObj["message"]).toEqual(component.message);
+ expect(component.finalPOSTObj["groupFormField"]).toEqual(component.groupFormField);
+ expect(component.finalPOSTObj["fieldType"]).toEqual(component.fieldType);
+ expect(component.finalPOSTObj["fieldSQL"]).toEqual(component.fieldSQL);
+ expect(component.finalPOSTObj["fieldName"]).toEqual(component.fieldName);
+ expect(component.finalPOSTObj["fieldId"]).toEqual(component.fieldId);
+ expect(component.finalPOSTObj["errorStackTrace"]).toEqual(component.errorStackTrace);
+ expect(component.finalPOSTObj["errorMessage"]).toEqual(component.errorMessage);
+ expect(component.finalPOSTObj["defaultValue"]).toEqual(component.defaultValue);
+ if(component.defaultValue===false)
+ expect(component.finalPOSTObj["fieldDefaultSQL"]).toBe(null);
+ else
+ expect(component.finalPOSTObj["fieldDefalultSQL"]).toEqual(component.fieldDefaultSQL);
+ expect(component.finalPOSTObj["predefinedValueList"]).toEqual(component.predefinedValueList);
+
+});
+
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.service.spec.ts
index 0452c246..acb7a952 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.service.spec.ts
@@ -2,15 +2,79 @@ import { TestBed } from '@angular/core/testing';
import { FormFieldsService } from './form-fields.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
describe('FormFieldsService', () => {
- beforeEach(() =>
+ let service:FormFieldsService;
+ beforeEach(() => {
TestBed.configureTestingModule({
- imports: [HttpClientTestingModule]
- }));
+ imports: [HttpClientTestingModule],
+ providers:[HttpClientModule,FormFieldsService]
+ })
+ service=TestBed.get(FormFieldsService);
+});
it('should be created', () => {
const service: FormFieldsService = TestBed.get(FormFieldsService);
expect(service).toBeTruthy();
});
+
+ it('should get getListOfFormFields', () => {
+ service.getListOfFormFields().subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl);
+ });
+ })
+
+ it('should get getFormFieldData', () => {
+ let id:String;
+ service.getFormFieldData("id").subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl+id);
+ });
+ })
+
+ it('should get postFormFieldData', () => {
+ let obj : any;
+ let reportId : string
+ service.postFormFieldData(obj,reportId).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl);
+ });
+ })
+
+ it('should get addFormFieldData', () => {
+ let obj : any;
+ let reportId : string
+ service.addFormFieldData(obj,reportId).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl);
+ });
+ })
+
+ it('should get deleteFormField', () => {
+ let id:String;
+ service.deleteFormField("id").subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl+id);
+ });
+ })
+
+ it('should get verifySQL', () => {
+ let queryObj : any;
+ service.verifySQL(queryObj).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl);
+ });
+ })
+
+ it('should get getFormFieldGroupsData', () => {
+ let reportId : any;
+ service.getFormFieldGroupsData(reportId).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl+reportId);
+ });
+ })
+
+ it('should get postFormFieldGroupsData', () => {
+ let formFieldGroupObj : any;
+ service.postFormFieldGroupsData(formFieldGroupObj).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl);
+ });
+ })
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
index 250affed..e2b08a4f 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
@@ -1,14 +1,28 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LogComponent } from './log.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { LogService } from './log.service';
+import { MockBackend } from '@angular/http/testing';
+import { BaseRequestOptions, Http } from '@angular/http';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs/Observable';
describe('LogComponent', () => {
let component: LogComponent;
let fixture: ComponentFixture<LogComponent>;
+ let logService:LogService;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ LogComponent ]
+ declarations: [ LogComponent ],
+ imports: [HttpClientTestingModule],
+ // providers:[LogService,MockBackend,BaseRequestOptions,{
+ // porvide:Http,useFactory:(backend:MockBackend,defaultOptions:BaseRequestOptions)=>{
+ // return new Http(backend,defaultOptions);
+ // },
+ // deps:[MockBackend,BaseRequestOptions],
+ // }]
})
.compileComponents();
}));
@@ -17,9 +31,30 @@ describe('LogComponent', () => {
fixture = TestBed.createComponent(LogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ logService=TestBed.get(LogService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ describe('should test subscribe',()=>{
+ it('should test ngOnInit method1',()=>{
+ component.reportType = "Dashboard";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("3");
+ })
+ })
+
+ it('should test ngOnInit method2',()=>{
+ component.reportType != "Dashboard";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("7");
+ })
+
+ it('should test subscribe method inside ngOnInit method',()=>{
+ let spy=spyOn(logService,'getLogData').and.returnValue(Observable.of('you object'));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.service.spec.ts
index d7b3b648..872a5de4 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.service.spec.ts
@@ -2,15 +2,32 @@ import { TestBed } from '@angular/core/testing';
import { LogService } from './log.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { HttpClient } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
describe('LogService', () => {
+
+ let service: LogService
+
beforeEach(() =>
+ {
TestBed.configureTestingModule({
- imports: [HttpClientTestingModule]
- }));
+ imports: [HttpClientTestingModule],
+ providers: [LogService, HttpClient, HttpClientTestingModule]
+ })
+ service = TestBed.get(LogService);
+
+});
it('should be created', () => {
const service: LogService = TestBed.get(LogService);
expect(service).toBeTruthy();
});
+
+ it('should getLogData', () => {
+ service.getLogData("test").subscribe((res) => {
+ expect(res).toBe(environment.baseUrl);
+ });
+ });
+
});
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 a273f9e0..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
@@ -1,13 +1,20 @@
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;
let fixture: ComponentFixture<RunReportFormFieldsComponent>;
+ let formfield =[{"validationType":1},{},{}] ;
beforeEach(async(() => {
TestBed.configureTestingModule({
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ imports: [FormsModule, MatDatepickerModule, HttpClientTestingModule, RouterTestingModule],
declarations: [ RunReportFormFieldsComponent ]
})
.compileComponents();
@@ -16,10 +23,91 @@ describe('RunReportFormFieldsComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(RunReportFormFieldsComponent);
component = fixture.componentInstance;
+ component.formFieldList = formfield;
fixture.detectChanges();
});
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 convertDate method', () => {
+ component.convertDate("test");
+ });
+
+ it('should test getQueryString methods', () => {
+ component.directCallQueryParams = 'abc';
+ 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);
+ });
+
+ 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-report-result-set/run-report-result-set.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.html
index 76183db3..71520ef7 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.html
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.html
@@ -15,7 +15,7 @@
</table>
<mat-paginator #paginator
- [length]="dataSource?.data.length"
+ [length]="dataSource?.data?.length"
[pageIndex]="0"
[pageSize]="15"
[pageSizeOptions]="[15, 25, 50, 100, 250]">
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts
index 3aa780fe..44765d49 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts
@@ -5,8 +5,11 @@ import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
import { RunReportResultSetComponent } from './run-report-result-set.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { HttpClient } from '@angular/common/http';
+import { RouterTestingModule } from '@angular/router/testing';
-describe('RunReportFinalTableComponent', () => {
+describe('RunReportResultSetComponent', () => {
let component: RunReportResultSetComponent;
let fixture: ComponentFixture<RunReportResultSetComponent>;
@@ -18,7 +21,9 @@ describe('RunReportFinalTableComponent', () => {
MatPaginatorModule,
MatSortModule,
MatTableModule,
- ]
+ HttpClientTestingModule,
+ RouterTestingModule
+ ],
}).compileComponents();
}));
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/dashboard-report.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/dashboard-report.service.spec.ts
index 5c6fc2cb..1c96f7ed 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/dashboard-report.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/dashboard-report.service.spec.ts
@@ -1,12 +1,37 @@
import { TestBed } from '@angular/core/testing';
import { DashboardReportService } from './dashboard-report.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { HttpClient } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
describe('DashboardReportService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+
+ let service: DashboardReportService;
+
+ beforeEach(() => {TestBed.configureTestingModule({
+ imports: [HttpClientTestingModule],
+ providers: [HttpClient, HttpClientTestingModule, DashboardReportService]
+ });
+ service = TestBed.get(DashboardReportService);
+
+});
it('should be created', () => {
const service: DashboardReportService = TestBed.get(DashboardReportService);
expect(service).toBeTruthy();
});
+
+ it('should getReportData', () => {
+ service.getReportData("test").subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
+ it('should getReportDataWithFormFields', () => {
+ service.getReportDataWithFormFields("just", "test").subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/run-dashboard-report.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/run-dashboard-report.component.spec.ts
index 38e7b3ba..e0ea762d 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/run-dashboard-report.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/run-dashboard-report.component.spec.ts
@@ -1,16 +1,40 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
+import { MatTableModule } from '@angular/material';
import { RunDashboardReportComponent } from './run-dashboard-report.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { RouterModule, Router } from '@angular/router';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+import { DashboardReportService } from './dashboard-report.service';
+import { MockBackend, MockConnection } from '@angular/http/testing';
+import { Http, BaseRequestOptions } from '@angular/http';
+import { Observable } from 'rxjs';
+import 'rxjs/add/observable/empty';
+import 'rxjs/add/observable/of';
+import { environment } from 'src/environments/environment';
describe('RunDashboardReportComponent', () => {
let component: RunDashboardReportComponent;
let fixture: ComponentFixture<RunDashboardReportComponent>;
+ let dashboardService : DashboardReportService;
+ let router: Router;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ RunDashboardReportComponent ]
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ RunDashboardReportComponent ],
+ imports: [MatTableModule, RouterTestingModule, HttpClientTestingModule],
+ providers:[DashboardReportService, MockBackend, BaseRequestOptions, {
+ provide: Http,
+ useFactory: (backend: MockBackend, defaultOptions: BaseRequestOptions) => {
+ return new Http(backend, defaultOptions);
+ },
+ deps: [MockBackend, BaseRequestOptions],
+ }]
})
.compileComponents();
+ dashboardService = TestBed.get(DashboardReportService);
+ router = TestBed.get(Router);
}));
beforeEach(() => {
@@ -19,7 +43,92 @@ describe('RunDashboardReportComponent', () => {
fixture.detectChanges();
});
- it('should create', () => {
+ it('should create', () => {
expect(component).toBeTruthy();
+ fixture.detectChanges();
+ });
+
+ it('should test ngOnInit method', () => {
+ component.queryString = "test";
+ component.ngOnInit();
+ expect(component.initialQueryString).toEqual("test");
+ expect(component.initCounter).toEqual(component.initCounter++);
+ spyOn(component, 'initialProcesses');
+ component.initialProcesses();
+ expect(component.initialProcesses).toHaveBeenCalled();
+ });
+
+ it('should test initialProcess method', () => {
+ component.initialProcesses();
+ expect(component.dataSource.paginator).toEqual(component.paginator);
+ });
+
+ it('should test ngOnChanges methods if condition', () => {
+
+ component.hitCnt = 1;
+ component.queryString = "testing"
+ component.initialQueryString === "test";
+ component.initCounter > 0;
+ component.runButtonHitCounter === 2;
+
+ component.ngOnChanges();
+ expect(component.initialQueryString).toEqual(component.queryString);
+ expect(component.runButtonHitCounter).toEqual(component.hitCnt);
+
+ spyOn(component, 'initialProcesses');
+ spyOn(component, 'afterViewInitProcesses');
+ component.initialProcesses();
+ component.afterViewInitProcesses();
+ expect(component.initialProcesses).toHaveBeenCalled();
+ expect(component.afterViewInitProcesses).toHaveBeenCalled();
+
});
+
+ it('should test ngOnChanges methods else condition', () => {
+
+ component.hitCnt = 1;
+ component.queryString = "testing"
+ component.initialQueryString === "testing";
+ component.initCounter = 0;
+ component.runButtonHitCounter === 1;
+
+ component.ngOnChanges();
+ expect(component.runButtonHitCounter).toBe(component.hitCnt);
+ expect(component.initialQueryString).toBe(component.queryString);
+
});
+
+ it('should test applyFilter method', () => {
+ component.applyFilter("testing");
+ expect(component.dataSource.filter).toEqual("testing".trim().toLowerCase());
+ });
+
+ it('should test afterViewInitProcesses method', () => {
+ component.afterViewInitProcesses();
+ expect(component.displayedColumnsArr).toEqual(new Array());
+ expect(component.displayedRowObj).toEqual(new Array());
+ expect(component.displayedColumns).toEqual(new Array());
+ expect(component.formFieldList).toEqual(new Array());
+ expect(component.showSpinner).toEqual(true);
+ expect(component.isReady).toEqual(false);
+ expect(component.NEWdisplayedColumns).toEqual(new Array());
+ });
+
+ it('should test linkToReport method', () => {
+ let reportId = "abc";
+ let queryParameters = "def";
+ component.linkToReport(reportId, queryParameters);
+ });
+
+ it('should test linkToFeedback method', () => {
+ let reportId = "abc";
+ let queryParameters = "def";
+ component.linkToFeedback(reportId, queryParameters);
+ });
+
+ it('should test linkToMail method', () => {
+ let mailID = "abc";
+ component.linkToMail(mailID);
+ });
+
+}); \ 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-report/run-report.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts
index f1d53d9e..509aa82e 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts
@@ -2,33 +2,153 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
-import { MatTableModule } from '@angular/material/table';
+import { MatTableModule, MatTableDataSource } from '@angular/material/table';
-import { RunReportComponent } from './run-report.component';
+import { RunReportComponent, PeriodicElement } from './run-report.component';
+import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SimpleChange, SimpleChanges } from '@angular/core';
+import { MatMenuModule } from '@angular/material';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+import { RunService } from '../run.service';
+import 'rxjs/add/observable/empty';
+import 'rxjs/add/observable/of';
-describe('RunReportFinalTableComponent', () => {
+describe('RunReportComponent', () => {
let component: RunReportComponent;
let fixture: ComponentFixture<RunReportComponent>;
+ const displayedColumnsArr1 = [];
+ const DashboardReportObj1 = [];
+ const trigger = ["a","b"];
+ let change : SimpleChanges;
+ let runService : RunService;
+ let options1 = {};
+ let dashboard;
+ let dashboard2;
+ let responseformfield = 1;
beforeEach(async(() => {
TestBed.configureTestingModule({
+ schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
declarations: [ RunReportComponent ],
imports: [
NoopAnimationsModule,
MatPaginatorModule,
MatSortModule,
MatTableModule,
- ]
+ MatMenuModule,
+ HttpClientTestingModule,
+ RouterTestingModule
+ ],
+ providers: [RunService]
}).compileComponents();
+ runService = TestBed.get(RunService);
}));
beforeEach(() => {
+ //dashboard = {"item":{"hasContent":{"name":"rupi","id":"check#check"}}};
fixture = TestBed.createComponent(RunReportComponent);
+ runService = TestBed.get(RunService);
component = fixture.componentInstance;
+ component.DashboardReportObj = DashboardReportObj1;
+ component.displayedColumnsArr = displayedColumnsArr1;
+ component.TriggerFFArr = trigger;
+ component.options = options1;
+ component.dashboard = dashboard;
+ component.responseFormFieldListLength = responseformfield;
fixture.detectChanges();
});
it('should compile', () => {
- expect(component).toBeTruthy();
+ expect(component).toBeTruthy();
});
+
+ it('should test the ngOnChanges second If condition', () => {
+ component.queryString = "test"
+ component.runButtonHitCnt = 1;
+ component.initialQueryString = "abc";
+ component.initCounter = 4;
+ component.hitCnt = 2;
+ component.ngOnChanges(change);
+
+ expect(component.runButtonHitCnt).toEqual(component.hitCnt);
+ expect(component.initialQueryString).toEqual("test");
+ spyOn(component, 'initialProcesses');
+ spyOn(component, 'afterViewInitialProcesses');
+ component.initialProcesses();
+ component.afterViewInitialProcesses();
+
+ expect(component.initialProcesses).toHaveBeenCalled();
+ expect(component.afterViewInitialProcesses).toHaveBeenCalled();
+});
+
+ it('should test afterViewInitialProcesses method', () => {
+ component.DashboardReportObj.length = 0;
+ component.reportMode = "Regular";
+ component.initCnt = 0;
+ component.afterViewInitialProcesses();
+
+ expect(component.showMoreVert).toEqual(false);
+ expect(component.displayedColumnsArr).toEqual(new Array());
+ expect(component.displayedRowObj).toEqual(new Array());
+ expect(component.displayedColumns).toEqual(new Array());
+ expect(component.formFieldList).toEqual(new Array());
+ expect(component.showSpinner).toEqual(true);
+ expect(component.isReady).toEqual(false);
+ expect(component.NEWdisplayedColumns).toEqual(new Array());
+ });
+
+ it('should test showError method', () => {
+ let errmsg = "errormessage";
+ let stcktrace = "stacktrace";
+ component.showError("test");
+ expect(component.errorMessage).toEqual("test"[errmsg]);
+ expect(component.stackTrace).toEqual("test"[stcktrace]);
+ expect(component.error).toEqual(true);
+ expect(component.showSpinner).toEqual(false);
+ });
+
+ it('should test linkToReport', () => {
+ component.linkToReport("test", "abc");
+ })
+
+ it('should test linkToFeedback', () => {
+ component.linkToFeedback("test", "abc");
+ })
+
+ it('should test linkToMail', () => {
+ component.linkToMail("test");
+ })
+
+ it('should test openOptions method', () => {
+ component.openOptions();
+ expect(component.openOptionsFlag).toEqual(component.openOptionsFlag);
+ });
+
+ it('should test downloadReportExcel method', () => {
+ component.downloadReportExcel();
+ });
+
+ it('should test applyFilter method', () => {
+ let filterValue = "test"
+ component.applyFilter(filterValue);
+ expect(component.dataSource.filter).toEqual(filterValue.trim().toLowerCase());
+ });
+
+ it('should test the ngOnChanges first If condition', () => {
+ change = {};
+ component.reportMode !== "Regular"
+ component.initCnt = 1;
+ component.TriggerFFArr.length = 0;
+ component.ngOnChanges(change);
+ expect(component.showMoreVert).toEqual(false);
+ expect(component.initCnt).toEqual(1);
+ expect(component.showDashboardReport).toEqual(false);
+ expect(component.displayedRowObj).toEqual(new Array());
+ expect(component.displayedColumns).toEqual(new Array());
+ expect(component.formFieldList).toEqual(new Array());
+ expect(component.showSpinner).toEqual(true);
+ expect(component.NEWdisplayedColumns).toEqual(new Array());
+ expect(component.isReady).toEqual(false);
+ });
+
});
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 e9439dda..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
@@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RunComponent } from './run.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RouterTestingModule } from '@angular/router/testing';
describe('RunComponent', () => {
let component: RunComponent;
@@ -8,7 +10,8 @@ describe('RunComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ RunComponent ]
+ declarations: [ RunComponent ],
+ imports: [HttpClientTestingModule, RouterTestingModule]
})
.compileComponents();
}));
@@ -22,4 +25,15 @@ describe('RunComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit method', () => {
+ component.reportType = "Dashboard";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("4");
+
+ component.reportType = "test";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("8");
+ });
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.spec.ts
index b50fc923..45bf2433 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.spec.ts
@@ -2,15 +2,60 @@ import { TestBed } from '@angular/core/testing';
import { RunService } from './run.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { HttpClient } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
describe('RunService', () => {
+ let service: RunService;
+
beforeEach(() =>
+ {
TestBed.configureTestingModule({
- imports: [HttpClientTestingModule]
- }));
+ imports: [HttpClientTestingModule],
+ providers: [HttpClient, HttpClientTestingModule, RunService]
+ });
+
+ service = TestBed.get(RunService);
+});
it('should be created', () => {
const service: RunService = TestBed.get(RunService);
expect(service).toBeTruthy();
});
+
+ it('should getReportData', () => {
+ service.getReportData("test").subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
+ it('should getReportDataWithFormFields', () => {
+ service.getReportDataWithFormFields("just", "testing").subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
+ it('should getDefinitionPageDetails', () => {
+ service.getDefinitionPageDetails(1).subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
+ it('should refreshFormFields', () => {
+ service.refreshFormFields("just", "testing").subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
+ it('should getFormFieldGroupsData', () => {
+ service.getFormFieldGroupsData("test").subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
+ it('should downloadReportExcel', () => {
+ service.downloadReportExcel("test").subscribe((res) => {
+ expect(res).toBe(new Blob);
+ });
+ });
});
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 b7f186b9..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
@@ -1,6 +1,10 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SecurityComponent } from './security.component';
+import { FormsModule } from '@angular/forms';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { componentRefresh } from '@angular/core/src/render3/instructions';
describe('SecurityComponent', () => {
let component: SecurityComponent;
@@ -8,7 +12,9 @@ describe('SecurityComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ SecurityComponent ]
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ SecurityComponent ],
+ imports: [FormsModule, HttpClientTestingModule]
})
.compileComponents();
}));
@@ -22,4 +28,58 @@ describe('SecurityComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit method', () => {
+ 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/security/security.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.service.spec.ts
index 3c495ce1..f339dcac 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.service.spec.ts
@@ -1,12 +1,104 @@
import { TestBed } from '@angular/core/testing';
import { SecurityService } from './security.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { environment } from 'src/environments/environment';
+import { HttpClient } from '@angular/common/http';
describe('SecurityService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ let service: SecurityService;
+
+ beforeEach(() =>{ TestBed.configureTestingModule({
+ imports: [HttpClientTestingModule],
+ providers: [SecurityService, HttpClientTestingModule, HttpClient]
+ })
+ service = TestBed.get(SecurityService);
+});
it('should be created', () => {
const service: SecurityService = TestBed.get(SecurityService);
expect(service).toBeTruthy();
});
+
+ it('should get reportOwnerList', () => {
+ service.getReportOwnerList().subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/wizard/security/retrieveReportOwner");
+ });
+ });
+
+ it('should get getReportRoleList', () => {
+ service.getReportRoleList().subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/wizard/security/retrieveReportRoleList");
+ });
+});
+
+it('should get getReportSecurityInfo', () => {
+ service.getReportSecurityInfo().subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/wizard/security/getReportSecurityInfo");
+ });
+});
+
+it('should get getReportUserList', () => {
+ service.getReportUserList().subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/wizard/security/retrieveReportUserList");
+ });
+});
+
+it('should get getReportSecurityRoles', () => {
+ service.getReportSecurityRoles().subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/wizard/security/getReportSecurityRoles");
+ });
+});
+
+it('should get addReportUser', () => {
+ let userId = "test"
+ service.addReportUser(userId).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/security/addReportUser");
+ });
+});
+
+it('should get removeReportUser', () => {
+ let userId = "test"
+ service.removeReportUser(userId).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/security/removeReportUser");
+ });
+});
+
+it('should get addUserEditAccess', () => {
+ let userId = "test"
+ let readOnly = "dummy"
+ service.addUserEditAccess(userId, readOnly).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/security/toggleUserEditAccess/");
+ });
+});
+
+it('should get addReportRole', () => {
+ let userId = "test"
+ service.addReportRole(userId).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/security/addReportRole");
+ });
+});
+
+it('should get removeReportRole', () => {
+ let userId = "test"
+ service.removeReportRole(userId).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/security/removeReportRole");
+ });
+});
+
+it('should get addRoleEditAccess', () => {
+ let userId = "test"
+ let readOnly = "dummy"
+ service.addRoleEditAccess(userId, readOnly).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/security/toggleRoleEditAccess/");
+ });
+});
+
+it('should get saveSecurityTabInfo', () => {
+ let test : any;
+ service.saveSecurityTabInfo(test).subscribe((resp) => {
+ expect(resp).toBe(environment.baseUrl + "report/security/updateReportSecurityInfo");
+ });
+});
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts
index 979b40f2..bf5f7f24 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts
@@ -2,9 +2,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SQLValidateErrorDialogComponent } from './sql-validate-error-dialog.component';
-describe('ValidateErrorComponentComponent', () => {
+describe('ValidateErrorComponent', () => {
let component: SQLValidateErrorDialogComponent;
let fixture: ComponentFixture<SQLValidateErrorDialogComponent>;
+ let tableobj: any=JSON.stringify({"errormessage":"DummyError","stacktrace":"trace"})
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -16,6 +17,7 @@ describe('ValidateErrorComponentComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(SQLValidateErrorDialogComponent);
component = fixture.componentInstance;
+ component.tableObj=tableobj;
fixture.detectChanges();
});
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 0f09e4eb..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
@@ -1,25 +1,107 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SQLComponent } from './sql.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+import { SqlService } from './sql.service';
+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;
let component: SQLComponent;
let fixture: ComponentFixture<SQLComponent>;
+ const reportId = "test";
+ const finalGetObj = {"query":"dummyQuery"}
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ SQLComponent ]
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ SQLComponent ],
+ imports: [FormsModule, HttpClientTestingModule, RouterTestingModule],
+ providers: [SqlService]
})
.compileComponents();
+ sqlService = TestBed.get(SqlService);
}));
beforeEach(() => {
+
fixture = TestBed.createComponent(SQLComponent);
component = fixture.componentInstance;
+ component.reportId1 = reportId;
+ component.finalGetObj = finalGetObj;
+ sqlService = TestBed.get(SqlService);
fixture.detectChanges();
+
});
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit method', () => {
+ component.ngOnInit();
+ expect(component.showSaveSQLDialog).toEqual(false);
+ expect(component.SQLPostResponse).toEqual(true);
+ expect(component.ValidatePostResponse).toEqual({});
+ });
+
+ it('should test ngOnChanges methods', () => {
+
+ fixture.detectChanges();
+ component.ngOnChanges();
+ expect(component.showSaveSQLDialog).toEqual(false);
+ expect(component.SQLPostResponse).toEqual(true);
+ expect(component.ValidatePostResponse).toEqual({});
+ });
+
+ 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.");
+ expect(component.showSaveSQLDialog).toEqual(component.showSaveSQLDialog);
+ expect(component.SQLclosable).toEqual(true);
+ });
+
+ it('should test validate method', () => {
+ component.validate();
+ });
+
+ it('should test closeSaveModal method', () => {
+ component.closeSaveModal();
+ expect(component.showSaveSQLDialog).toEqual(component.showSaveSQLDialog);
+ expect(component.SQLclosable).toEqual(false);
+ });
+
+ it('should test closeValidateModal method', () => {
+ 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', () => {
+ component.SetValidateResponseString("testing");
+ expect(component.ValidateResponseString).toEqual("testing");
+ });
+
+ it('should test GetValidateResponseString method', () => {
+ component.ValidateResponseString = 'test';
+ expect(component.GetValidateResponseString()).toEqual("test");
+ });
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.service.spec.ts
index addec39f..68978d90 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.service.spec.ts
@@ -1,12 +1,37 @@
import { TestBed } from '@angular/core/testing';
import { SqlService } from './sql.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { HttpClient } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
describe('SqlService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+
+ let service: SqlService;
+
+ beforeEach(() => {TestBed.configureTestingModule({
+ imports: [HttpClientTestingModule],
+ providers: [SqlService, HttpClient, HttpClientTestingModule]
+ })
+ service = TestBed.get(SqlService);
+});
it('should be created', () => {
const service: SqlService = TestBed.get(SqlService);
expect(service).toBeTruthy();
});
+
+ it('should getSQLTabData', () => {
+ service.getSQLTabData("test").subscribe((res) => {
+ expect(res).toBe(environment);
+ });
+ });
+
+ it('should postSQLValidateAndSave', () => {
+ service.postSQLValidateAndSave("test").subscribe((res) => {
+ expect(res).toBe(environment)
+ });
+ });
+
+
});