summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-04-19 23:56:54 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-19 23:56:54 +0000
commit2a0c3f8b3ca0c12311837016c2e6f3444916d86f (patch)
tree5fe1401dfa7fb8e1efd1ad24b738b49e147196ec
parentd9935ff090351779bbced307a9d302a90bc6a626 (diff)
parenta2af683e8d8c24a33274908b7e0288f7c6e51978 (diff)
Merge "wrote test case for dashboard-report-grid comp"
-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.ts23
1 files changed, 23 insertions, 0 deletions
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 6d0c2946..d1ed8068 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
@@ -3,10 +3,21 @@ 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';
+import { DashboardReportService } from '../../run/run-report/run-dashboard-report/dashboard-report.service';
+import { DashboardReportGridService } from './dashboard-report-grid.service';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs';
+import { GridsterItem } from 'angular-gridster2';
describe('DashboardReportGridComponent', () => {
let component: DashboardReportGridComponent;
let fixture: ComponentFixture<DashboardReportGridComponent>;
+ let service;
+ let environment = [
+ {
+ baseUrl: 'just for testing'
+ }
+ ];
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -15,11 +26,15 @@ describe('DashboardReportGridComponent', () => {
imports: [FormsModule, HttpClientTestingModule]
})
.compileComponents();
+ service = TestBed.get(DashboardReportGridService);
+ spyOn(service, 'getReportList').and.returnValue(Observable.of(environment));
}));
beforeEach(() => {
fixture = TestBed.createComponent(DashboardReportGridComponent);
component = fixture.componentInstance;
+ environment ["rows"] = [""];
+ component.dashboard ["hasContent"] = [""];
fixture.detectChanges();
});
@@ -28,7 +43,9 @@ describe('DashboardReportGridComponent', () => {
});
it('should test ngOnInit method', () => {
+ spyOn(component, 'ngOnInit').and.callThrough();
component.ngOnInit();
+ expect(component.ngOnInit).toHaveBeenCalled();
});
it('should test changedOption method', () => {
@@ -47,4 +64,10 @@ describe('DashboardReportGridComponent', () => {
component.addItem();
});
+ it('should test emptyCellClick method', () => {
+ let event: MouseEvent;
+ let item: GridsterItem;
+ component.emptyCellClick(event, item);
+ });
+
}); \ No newline at end of file