summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRupinder <rupinsi1@in.ibm.com>2020-03-03 12:35:03 +0530
committerRupinder <rupinsi1@in.ibm.com>2020-03-03 12:35:11 +0530
commit0f3e54b2a9533f0f6b1d9ee62b62fb78c5ed7dca (patch)
tree983717cfca5f41e89790ba41ccd3eb169dd3eb7d
parent72c2f40e9220af16f23f3265f85363bda2b8f1c9 (diff)
added test cases for run-dashboard-report component
Written test cases for run-dashboard-report.component.spec.ts Issue-ID: PORTAL-834 Change-Id: I71f563670f8da8f4cbf131abf20b12e819ff0f75 Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
-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.ts44
1 files changed, 32 insertions, 12 deletions
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 9e1cd459..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
@@ -2,7 +2,7 @@ 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 } from '@angular/router';
+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';
@@ -17,6 +17,7 @@ describe('RunDashboardReportComponent', () => {
let component: RunDashboardReportComponent;
let fixture: ComponentFixture<RunDashboardReportComponent>;
let dashboardService : DashboardReportService;
+ let router: Router;
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -33,6 +34,7 @@ describe('RunDashboardReportComponent', () => {
})
.compileComponents();
dashboardService = TestBed.get(DashboardReportService);
+ router = TestBed.get(Router);
}));
beforeEach(() => {
@@ -82,12 +84,25 @@ describe('RunDashboardReportComponent', () => {
});
+ 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());
@@ -99,16 +114,21 @@ describe('RunDashboardReportComponent', () => {
expect(component.NEWdisplayedColumns).toEqual(new Array());
});
- describe('Should test afterViewInitProcesses', () => {
- it('should validate on afterViewInitProcesses subscribe return', () => {
- let spy = spyOn(dashboardService, 'getReportDataWithFormFields')
- .and.returnValue(Observable.of());
- component.afterViewInitProcesses();
- // expect(component.formFieldPresent).toEqual(false);
- // expect(component.responseFormFieldListLength).toEqual(0);
- expect(spy).toHaveBeenCalled();
-
+ 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