summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp
diff options
context:
space:
mode:
authorSunder Tattavarada <statta@research.att.com>2020-03-03 15:19:51 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-03 15:19:51 +0000
commit4ddb402301e25cb4dc80fc6ac64b08b0a224e187 (patch)
tree23c89aabbc6a16091cc68ccdabfb3b75fe59c1f2 /ecomp-sdk/epsdk-app-overlay/src/main/webapp
parentaf78bb6c38e4944cdf8d4ab79366eff94a0e2c6d (diff)
parentda263e557b4d104cc0a0496daf31cc3437560421 (diff)
Merge "added test cases for report-list component"
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts69
1 files changed, 66 insertions, 3 deletions
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 b61e9c56..359bee9f 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
@@ -2,22 +2,30 @@ 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 { ReportListComponent } from './report-list.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+import { Router } from '@angular/router';
+import { AllReportsDataSource } from './report-list-datasource';
-describe('AllReportsComponent', () => {
+describe('ReportListComponent', () => {
let component: ReportListComponent;
let fixture: ComponentFixture<ReportListComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [ ReportListComponent ],
imports: [
NoopAnimationsModule,
MatPaginatorModule,
MatSortModule,
MatTableModule,
+ HttpClientTestingModule,
+ RouterTestingModule
]
}).compileComponents();
}));
@@ -31,4 +39,59 @@ describe('AllReportsComponent', () => {
it('should compile', () => {
expect(component).toBeTruthy();
});
-});
+
+ it('should test initializeReportList method', () => {
+ component.initializeReportList();
+ expect(component.showSpinner).toEqual(true);
+ expect(component.dataSource).toEqual(new AllReportsDataSource());
+ expect(component.intermediateDisplayedColumns).toEqual(new Array());
+ expect(component.finalGETObj).toEqual(new Object());
+ expect(component.finalGETObjRowsArr).toEqual(new Array());
+ expect(component.rowArr).toEqual(new Array());
+ expect(component.reportIdArr).toEqual(new Array());
+ expect(component.toggle).toEqual(false);
+ expect(component.toggle1).toEqual(false);
+ expect(component.finalRowArr).toEqual(new Array());
+ });
+
+ it('should test ngOnInit method', () => {
+ component.ngOnInit();
+ expect(component.toggle).toEqual(false);
+ });
+
+ it('should test confirmDelete method', () => {
+ component.confirmDelete("test");
+ expect(component.showDialog).toEqual(true);
+ expect(component.closable).toEqual(true);
+ expect(component.newReportId).toEqual("test");
+ });
+
+ it('should test ngAfterViewInit method', () => {
+ component.ngAfterViewInit();
+ expect(component.dataSource.sort).toEqual(component.sort);
+ expect(component.dataSource.paginator).toEqual(component.paginator);
+ expect(component.table.dataSource).toEqual(component.dataSource);
+ });
+
+ it('should test displayReport method', () => {
+ component.displayReport("Testing");
+ expect(component.reportId).toEqual("Testing");
+ });
+
+ it('should test runReport method', () => {
+ component.runReport("Test");
+ expect(component.reportId).toEqual("Test");
+ });
+
+ it('should test applyFilter method', () => {
+ component.applyFilter("ABC");
+ expect(component.dataSource1.filter).toEqual("abc");
+
+ });
+
+ it('should test close method', () => {
+ component.close();
+ expect(component.showDialog).toEqual(true);
+ expect(component.closable).toEqual(false);
+ })
+}); \ No newline at end of file