diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-29 10:48:12 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-29 10:48:12 +0000 |
commit | 714e325ab0e9008b80c50786a578c7f59f90fdb3 (patch) | |
tree | 72b25cfc5bba4b0129547331cd57667b29892ae8 /ecomp-sdk/epsdk-app-overlay/src | |
parent | 6db20c37bd0fcfe65c6ff8dfa5f93caf95515547 (diff) | |
parent | a67f13f058496cdc1d4afe02a3c041b093e0d4c9 (diff) |
Merge "test cases in run-report component"
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/run-report.component.spec.ts | 45 |
1 files changed, 21 insertions, 24 deletions
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 a41b11cd..2aeac4a2 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,10 +2,10 @@ 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, MatTableDataSource } from '@angular/material/table'; +import { MatTableModule} from '@angular/material/table'; -import { RunReportComponent, PeriodicElement } from './run-report.component'; -import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SimpleChange, SimpleChanges } from '@angular/core'; +import { RunReportComponent} from './run-report.component'; +import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SimpleChanges } from '@angular/core'; import { MatMenuModule } from '@angular/material'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { RouterTestingModule } from '@angular/router/testing'; @@ -24,13 +24,12 @@ describe('RunReportComponent', () => { let runService : RunService; let options1 = {}; let dashboard; - let dashboard2; let responseformfield = 1; let environment = [ { baseUrl: 'just a link' } - ] + ]; beforeEach(async(() => { @@ -49,13 +48,10 @@ describe('RunReportComponent', () => { providers: [RunService] }).compileComponents(); runService = TestBed.get(RunService); - //spyOn(runService, 'getReportDataWithFormFields').and.returnValue(Observable.of(environment)); - //spyOn(runService, 'getReportData').and.returnValue(Observable.of(environment)); spyOn(runService, 'downloadReportExcel').and.returnValue(Observable.of(environment)); })); beforeEach(() => { - //dashboard = {"item":{"hasContent":{"name":"rupi","id":"check#check"}}}; fixture = TestBed.createComponent(RunReportComponent); runService = TestBed.get(RunService); component = fixture.componentInstance; @@ -107,6 +103,7 @@ describe('RunReportComponent', () => { expect(component.NEWdisplayedColumns).toEqual(new Array()); }); + it('should test showError method', () => { let errmsg = "errormessage"; let stcktrace = "stacktrace"; @@ -148,40 +145,40 @@ describe('RunReportComponent', () => { it('should test the ngOnChanges first If condition', () => { change = {}; + component.queryString="queryString"; + component.reportId1="reportId1"; + var response={"errormessage":true} component.reportMode !== "Regular" component.initCnt = 1; component.TriggerFFArr.length = 0; + let spy=spyOn(runService,'getReportDataWithFormFields').and.returnValue(Observable.of(response)); component.ngOnChanges(change); - expect(component.showMoreVert).toEqual(false); + expect(spy).toHaveBeenCalled(); 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); + }); + it('should test initialProcess method', () => { component.DashboardReportObj.length = 1; component.initialProcesses(); }); - // it('should test postFetchingReportDataFn method', () => { - // let response: any; - // component.postFetchingReportDataFn(response); - // }) - - // it('should test ngOnChanges subscribe method', () => { - // spyOn(component, 'ngOnChanges').and.callThrough(); - // component.ngOnChanges(change); - // expect(component.ngOnChanges).toHaveBeenCalled(); + // it('should test postFetchingReportDataFn method',()=>{ + // var response={ + // "reportName":"reportName", + // "reportDataColumns":[{"columnTitle":"columnTitle","colId":"colId"}], + // "reportDataRows":[{"value":"value"}] + // } + // component.displayedColumnsArr=["string"] + // component.postFetchingReportDataFn(response) // }) - // it('should test postFetchingReportDataFn method', () => { - // let obj: any; - // component.postFetchingReportDataFn(obj); - // }) - + }); |