summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts7
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/dashboard/dashboard.component.spec.ts6
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts5
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts25
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts49
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts5
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts14
-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.ts29
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/user/user.service.spec.ts25
9 files changed, 156 insertions, 9 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts
index 02cfd6b6..efe2de10 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright © 2019 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modification Copyright © 2020 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@@ -74,4 +76,9 @@ describe('HeaderComponent', () => {
document.getElementById("body").classList.add("push-right");
expect(component.isToggled()).toBe(true);
});
+
+ it('should test ngOnInit function', () => {
+ component.ngOnInit();
+ });
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/dashboard/dashboard.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/dashboard/dashboard.component.spec.ts
index 21423380..c28734a4 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/dashboard/dashboard.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/dashboard/dashboard.component.spec.ts
@@ -29,4 +29,10 @@ describe('DashboardComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test the functions is called properly in constructor',() => {
+ expect(component.alerts.push).toHaveBeenCalled;
+ expect(component.sliders.push).toHaveBeenCalled;
+ });
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts
index 04a691b9..f7548eef 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts
@@ -49,4 +49,9 @@ describe('MenusComponent', () => {
expect(adminservice.getFnMenuItems).toHaveBeenCalled();
}));
+ it('should test removeMenuItems function', () => {
+ component.removeMenuItem(item);
+ expect(component.removeMenuItem).toHaveBeenCalled();
+ })
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts
index a03f2e71..a19fd52a 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts
@@ -1,14 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RoleFunctionsComponent } from './role-functions.component';
+import { AdminService } from '../admin.service';
+import { inject } from '@angular/core/testing';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
describe('RoleFunctionsComponent', () => {
let component: RoleFunctionsComponent;
let fixture: ComponentFixture<RoleFunctionsComponent>;
+ let modalService: any;
+ let item: any;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ RoleFunctionsComponent ]
+ declarations: [ RoleFunctionsComponent ],
+ imports: [NgbModal]
})
.compileComponents();
}));
@@ -17,9 +23,26 @@ describe('RoleFunctionsComponent', () => {
fixture = TestBed.createComponent(RoleFunctionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ modalService = TestBed.get(NgbModal);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test getDismissReason function', inject([AdminService],(adminservice) => {
+ component.getRoleFunctions();
+ expect(adminservice.getRoleFunctionsList).toHaveBeenCalled();
+ }));
+
+ it('should test getDismissReason function to call ngModal.open function', () => {
+ component.delRoleFunction({'label': 'abc'});
+ expect(modalService.open).toHaveBeenCalled();
+ });
+
+ it('should test delRoleFunction function', () => {
+ component.delRoleFunction(item);
+ expect(component.delRoleFunction).toHaveBeenCalled();
+})
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
index 42544a72..f491f372 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
@@ -3,11 +3,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FormFieldsComponent } from './form-fields.component';
describe('FormFieldsComponent', () => {
- let component: FormFieldsComponent;
+ let component: FormFieldsComponent;
let fixture: ComponentFixture<FormFieldsComponent>;
-
+
beforeEach(async(() => {
- TestBed.configureTestingModule({
+ TestBed.configureTestingModule({
declarations: [ FormFieldsComponent ]
})
.compileComponents();
@@ -17,9 +17,50 @@ describe('FormFieldsComponent', () => {
fixture = TestBed.createComponent(FormFieldsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
- });
+ });
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit function', () => {
+ component.ngOnInit();
+ });
+
+ it('should test isLast functions', () =>{
+ component.formFieldsListObj = [1,2,3,4,5];
+ let test: Boolean = component.isLast(3);
+ expect(test).toEqual(false);
+ });
+
+ it('should test isFirst function', () => {
+ let test: Boolean = component.isFirst(0);
+ expect(test).toEqual(true);
+ });
+
+ it('should test ngDoCheck', () => {
+ component.sqlAsDefaultValue = true;
+ component.ngDoCheck();
+ expect(component.showDefaultSQLOption).toEqual(true);
+ });
+
+ it('should test close function', () => {
+ component.close();
+ expect(component.closable).toEqual(false);
+ });
+
+ it('should test closeValidateModal', () => {
+ component.closeValidateModal();
+ expect(component.showSpinner).toEqual(false);
+ });
+
+ it('should test openDialog method', () => {
+ expect(component.openDialog).toHaveBeenCalled();
+ });
+
+ it('should test openSnackBar method', () => {
+ component.openSnackBar("Just", "for testing");
+ expect(component.openSnackBar).toHaveBeenCalled();
+ })
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
index 250affed..a0d81915 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
@@ -22,4 +22,9 @@ describe('LogComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit method', () => {
+ expect(component.ngOnInit).toHaveBeenCalled;
+ })
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts
index a273f9e0..55161812 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts
@@ -22,4 +22,18 @@ describe('RunReportFormFieldsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit method', () =>{
+ component.ngOnInit();
+ expect(component.showSpinner).toEqual(true);
+ expect(component.navigateToRun).toEqual(false);
+ });
+
+ it('should test QueryString method', () =>{
+ component.directCallQueryParams == "test";
+ component.getQueryString();
+ expect(component.getQueryString).toEqual("test");
+ })
+
+
});
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 f1d53d9e..b897f149 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
@@ -31,4 +31,33 @@ describe('RunReportFinalTableComponent', () => {
it('should compile', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit method ', () => {
+ component.ngOnInit();
+ expect(component.initialProcesses()).toHaveBeenCalled();
+ });
+
+ it('should test initialProcess method', () => {
+ component.DashboardReportObj.length = 1;
+ component.initialProcesses();
+ expect(component.options.scrollSpeed).toEqual(20);
+ });
+
+ it('should test showError method', () => {
+ component.showError("abc");
+ expect(component.error).toEqual(true);
+ expect(component.showSpinner).toEqual(false);
+ });
+
+ it('should test afterViewInitialProcesses method ', () =>{
+ component.DashboardReportObj.length === 0;
+ component.reportMode === "Regular";
+ component.initCnt == 0;
+
+ component.afterViewInitialProcesses();
+ expect(component.showMoreVert).toEqual(false);
+ expect(component.NEWdisplayedColumns).toEqual(new Array());
+ });
+
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/user/user.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/user/user.service.spec.ts
index d6d659b9..e1af3d4c 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/user/user.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/user/user.service.spec.ts
@@ -1,15 +1,32 @@
-import { TestBed } from '@angular/core/testing';
+import { TestBed, async } from '@angular/core/testing';
import { HttpClientModule } from '@angular/common/http';
import { UserService } from './user.service';
+import { User } from './user';
describe('UserService', () => {
- beforeEach(() => TestBed.configureTestingModule({
- imports:[HttpClientModule]
- }));
+
+ let service: UserService ;
+ let dummyUser: User;
+
+ beforeEach( () =>
+ TestBed.configureTestingModule({
+ imports:[HttpClientModule],
+ providers: [UserService],
+ }),
+ );
it('should be created', () => {
const service: UserService = TestBed.get(UserService);
expect(service).toBeTruthy();
});
+
+ it('should test getFunctionalMenuStaticDetailSession2', () =>{
+
+ let response: Object = service.getFunctionalMenuStaticDetailSession2();
+ expect(response).toEqual(User);
+
+ });
+
+
});