summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main
diff options
context:
space:
mode:
authorSunder Tattavarada <statta@research.att.com>2020-03-06 15:19:26 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-06 15:19:26 +0000
commit291bc599dd9fbbb7b26dae3f24bcaf132d40a8f7 (patch)
treeae01e2f7264819b9ace2a8fb4ddce77c5699b19a /ecomp-sdk/epsdk-app-overlay/src/main
parent81a75a99176990742e85d6169d966fe93d0a1c4a (diff)
parent3c39aa2da2b75950f4362d07ea5e617bb95fee31 (diff)
Merge "some test cases in column-list component"
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main')
-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.ts129
1 files changed, 127 insertions, 2 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 6d6e9431..8442c873 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,4 +1,3 @@
-
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatPaginatorModule } from '@angular/material/paginator';
@@ -8,14 +7,20 @@ 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 { ColumnService } from '../column.service';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs/Observable';
+
describe('ColumnListComponent', () => {
let component: ColumnListComponent;
let fixture: ComponentFixture<ColumnListComponent>;
+ let _columnService: ColumnService;
+
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ ColumnListComponent ],
+ declarations: [ ColumnListComponent],
imports: [
NoopAnimationsModule,
MatPaginatorModule,
@@ -32,10 +37,130 @@ describe('ColumnListComponent', () => {
fixture = TestBed.createComponent(ColumnListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ _columnService=TestBed.get(ColumnService);
});
it('should compile', () => {
expect(component).toBeTruthy();
});
+ it('should test editRecord method',()=>{
+ component.editRecord("id");
+ expect(component.showSpinner).toBe(true);
+ expect(component.columnId).toEqual("id");
+
+ })
+
+ it('should test subscribe in editRecord method',()=>{
+
+ let spy1=spyOn(_columnService,'getIndividualColumnData').and.returnValue(Observable.of('you object'));
+ let spy2=spyOn(_columnService,'getDrillDownReportList').and.returnValue(Observable.of('you object'));
+ let spy3=spyOn(_columnService,'getResponseTotalColsList').and.returnValue(Observable.of('you object'));
+ component.editRecord("id");
+
+ expect(component.columnId).toEqual("id");
+ expect(spy1).toHaveBeenCalled();
+ expect(spy2).toHaveBeenCalled();
+ expect(spy3).toHaveBeenCalled();
+
+ })
+
+ it('should test ngOnChanges method',()=>{
+ spyOn(console,'log');
+ component.ngOnChanges();
+ expect(console.log).toHaveBeenCalledWith("Hit");
+ })
+
+ it('should test close method',()=>{
+ let spy1=spyOn(_columnService,'getColumnList').and.returnValue(Observable.of(''));
+ component.close();
+ expect(spy1).toHaveBeenCalled();
+ expect(component.finalObjArr).toEqual([]);
+ expect(component.finalGetObj).toEqual('');
+ expect(component.dataSource.data).toEqual(component.finalObjArr);
+ expect(component.dataSource.sort).toEqual(component.sort);
+ expect(component.dataSource.paginator).toEqual(component.paginator);
+ expect(component.table.dataSource).toEqual(component.dataSource)
+ expect(component.showSpinner).toEqual(false);
+ })
+
+ it('should test complete method',()=>{
+ component.showEditDrillDownPage=true;
+ component.complete();
+ expect(component.showEditDrillDownPage).toBe(false);
+ expect(component.showConfirmButton).toBe(false);
+ })
+
+it('should test onCompleted method',()=>{
+ component.onCompleted("drilldownParamsArr");
+ expect(component.drilldownParams).toBeUndefined();
+})
+
+it('should test save method',()=>{
+ component.noWrap=true;
+ component.save();
+ expect(component.showSpinner).toBe(true);
+ expect(component.finalPOSTObj["tabId"]).toEqual("ColEdit");
+ expect(component.finalPOSTObj["tabName"]).toEqual("Column Edit");
+ expect(component.finalPOSTObj["colId"]).toEqual(component.id);
+ expect(component.finalPOSTObj["colName"]).toEqual(component.name);
+ expect(component.finalPOSTObj["colType"]).toEqual("");
+ expect(component.finalPOSTObj["colspan"]).toEqual(component.colspan);
+ expect(component.finalPOSTObj["dataType"]).toEqual(component.dataType);
+ expect(component.finalPOSTObj["depeondsOnForField"]).toEqual(component.dependsOnFormFields);
+ expect(component.finalPOSTObj["displayAlignment"]).toEqual(component.displayAlignment);
+ expect(component.finalPOSTObj["displayHeaderAlignment"]).toEqual(component.displayHeaderAlignment);
+ expect(component.finalPOSTObj["displayName"]).toEqual(component.displayName);
+ expect(component.finalPOSTObj["displayTotal"]).toEqual(component.displayTotal);
+ expect(component.finalPOSTObj["displayWidth"]).toEqual(10);
+ expect(component.finalPOSTObj["displayWidthInPixel"]).toEqual(component.displayWidthInPixel);
+ //expect(component.finalPOSTObj[""]).toEqual();
+ expect(component.finalPOSTObj["drilldownParams"]).toEqual(component.drilldownParams);
+ expect(component.finalPOSTObj["drilldownType"]).toEqual("");
+ expect(component.finalPOSTObj["drilldownURL"]).toEqual(component.drilldownURL);
+ expect(component.finalPOSTObj["errorMessage"]).toEqual("");
+ expect(component.finalPOSTObj["errorStackTrace"]).toEqual("");
+ expect(component.finalPOSTObj["groupByPos"]).toEqual(component.groupByPos);
+ expect(component.finalPOSTObj["hideRepeatedKey"]).toEqual(component.hideRepeatedValues);
+ expect(component.finalPOSTObj["indentation"]).toEqual(component.indentation);
+ expect(component.finalPOSTObj["level"]).toEqual(component.multiGroupColumnLevel);
+ expect(component.finalPOSTObj["noWrap"]).toEqual("Y");
+ expect(component.finalPOSTObj["sortable"]).toEqual(component.sortable);
+ expect(component.finalPOSTObj["subTotalCustomText"]).toEqual(component.displayTotal);
+ expect(component.finalPOSTObj["visible"]).toEqual(component.visible);
+
+
+})
+
+it('should test if codition inside save method',()=>{
+ component.showSaveColDialog=true;
+ let spy=spyOn(_columnService,'postColumnChanges').and.returnValue(Observable.of('you object'))
+ component.save();
+ expect(spy).toHaveBeenCalled();
+ expect(component.EditColstatus).toEqual("Success!");
+ expect(component.EditColmessage).toEqual("Your change has been saved! Row definition is updated.");
+ expect(component.showSaveColDialog).toBe(false);
+ expect(component.Colclosable).toBe(true);
+})
+
+it('should test else codition inside save method',()=>{
+ component.showSaveColDialog=true;
+ let spy=spyOn(_columnService,'postColumnChanges').and.returnValue(Observable.of(''))
+ component.save();
+ expect(spy).toHaveBeenCalled();
+ expect(component.EditColstatus).toEqual("Failure!");
+ expect(component.EditColmessage).toEqual("Row definition could not be updated.");
+ expect(component.showSaveColDialog).toBe(false);
+ expect(component.Colclosable).toBe(true);
+})
+
+it('should be testing drillDownLinkPage method',()=>{
+ component.showEditDrillDownPage=true
+ component.drillDownLinkPage();
+ expect(component.showEditDrillDownPage).toEqual(false);
+ expect(component.showConfirmButton).toBe(true);
+})
+
+
+
});