summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts52
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts10
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts9
-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.ts44
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts12
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts37
-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.ts63
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts6
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts48
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts4
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts59
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts7
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts6
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts11
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts14
15 files changed, 293 insertions, 89 deletions
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 b0dc3442..8c958531 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
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (C) 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");
@@ -35,28 +37,70 @@
*
*
*/
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
import { RoleFunctionsComponent } from './role-functions.component';
+import { CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RdpModule } from 'portalsdk-tag-lib';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { UserService } from 'src/app/shared/services/user/user.service';
+import { AdminService } from '../admin.service';
+import { MatSelectModule, MatAutocompleteModule } from '@angular/material';
+import { Observable } from 'rxjs';
describe('RoleFunctionsComponent', () => {
let component: RoleFunctionsComponent;
let fixture: ComponentFixture<RoleFunctionsComponent>;
+ let userService:UserService;
+ let adminService:AdminService;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ RoleFunctionsComponent ]
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ RoleFunctionsComponent ],
+ imports: [HttpClientTestingModule,
+ RdpModule,
+ FormsModule,
+ // MatSelectModule,
+ ],
+ providers:[MatSelectModule]
})
.compileComponents();
- }));
+ }));
beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers:[AdminService]
+ })
fixture = TestBed.createComponent(RoleFunctionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ userService=TestBed.get(UserService);
+ adminService=TestBed.get(AdminService);
});
- it('should create', () => {
+ it('should create', () => {
expect(component).toBeTruthy();
});
+
+ describe('test for subscribe in ngOnInit',()=>{
+ it('should test ngOnInit method',()=>{
+ let spy=spyOn(userService,'getFunctionalMenuStaticDetailSession').and.returnValue(Observable.of('you object'));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
+ })
+ it('Admin service injection check', inject([AdminService],(injectService:AdminService) =>{
+ expect(injectService).toBe(adminService);
+ }));
+
+ // describe('test subscribe in getRoleFunctions',()=>{
+ // it('should test getRoleFunctions method',()=>{
+ // let spy=spyOn(adminService,'getRoleFunctionList').and.returnValue(Observable.of('you object'));
+ // component.getRoleFunctions();
+ // expect(spy).toHaveBeenCalled();
+ // })
+ // })
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts
index 2a4b5c33..8af2689a 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts
@@ -4,6 +4,9 @@
* ===================================================================
* 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");
@@ -39,6 +42,9 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RolesComponent } from './roles.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { MatTableModule } from '@angular/material';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('RolesComponent', () => {
let component: RolesComponent;
@@ -46,7 +52,9 @@ describe('RolesComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ RolesComponent ]
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ RolesComponent ],
+ imports:[MatTableModule,HttpClientTestingModule]
})
.compileComponents();
}));
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts
index d6812789..01f31669 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts
@@ -4,6 +4,9 @@
* ===================================================================
* 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");
@@ -39,6 +42,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UsageComponent } from './usage.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('UsageComponent', () => {
let component: UsageComponent;
@@ -46,7 +51,9 @@ describe('UsageComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ UsageComponent ]
+ declarations: [ UsageComponent ],
+ schemas:[CUSTOM_ELEMENTS_SCHEMA],
+ imports:[HttpClientTestingModule]
})
.compileComponents();
}));
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 b9d63853..6d0c2946 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
@@ -29,30 +29,22 @@ describe('DashboardReportGridComponent', () => {
it('should test ngOnInit method', () => {
component.ngOnInit();
- expect(component.showSpinner).toEqual(true);
- expect(component.options.outerMargin).toEqual(true);
- expect(component.options.outerMarginTop).toEqual(10);
- expect(component.options.outerMarginRight).toEqual(10);
- expect(component.options.outerMarginBottom).toEqual(700);
- expect(component.options.outerMarginLeft).toEqual(10);
- expect(component.options.scrollSensitivity).toEqual(10);
- expect(component.options.scrollSpeed).toEqual(20);
- expect(component.options.emptyCellDragMaxCols).toEqual(null);
- expect(component.options.emptyCellDragMaxRows).toEqual(null);
- expect(component.options.enableOccupiedCellDrop).toEqual(true);
- expect(component.options.ignoreMarginInRow).toEqual(false);
- expect(component.options.draggable.enabled).toEqual(true);
- expect(component.options.resizable.enabled).toEqual(true);
- expect(component.options.swap).toEqual(false);
- expect(component.options.pushItems).toEqual(true);
- expect(component.options.disablePushOnDrag).toEqual(false);
- expect(component.options.disablePushOnResize).toEqual(false);
- expect(component.options.pushResizeItems).toEqual(true);
- expect(component.options.disableWindowResize).toEqual(true);
- expect(component.options.disableWarnings).toEqual(false);
- expect(component.options.scrollToNewItems).toEqual(true);
- expect(component.options.enableEmptyCellDrop).toEqual(true);
- expect(component.options.minCols).toEqual(2);
- expect(component.options.minRows).toEqual(2);
- })
+ });
+
+ it('should test changedOption method', () => {
+ component.changedOptions();
+ });
+
+ it('should test assignCopy method', () => {
+ component.assignCopy();
+ });
+
+ it('should test filterItem method', () => {
+ component.filterItem(1);
+ });
+
+ it('should test addItem method', () => {
+ component.addItem();
+ });
+
}); \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts
index 26e51d34..e137dfd6 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts
@@ -1,6 +1,10 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DefinitionComponent } from './definition.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { FormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
describe('PilotPageComponent', () => {
let component: DefinitionComponent;
@@ -8,7 +12,13 @@ describe('PilotPageComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ DefinitionComponent ]
+ schemas:[CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ DefinitionComponent ],
+ imports:[
+ FormsModule,
+ HttpClientTestingModule,
+ RouterTestingModule
+ ]
})
.compileComponents();
}));
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..e2b08a4f 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
@@ -1,14 +1,28 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LogComponent } from './log.component';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { LogService } from './log.service';
+import { MockBackend } from '@angular/http/testing';
+import { BaseRequestOptions, Http } from '@angular/http';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs/Observable';
describe('LogComponent', () => {
let component: LogComponent;
let fixture: ComponentFixture<LogComponent>;
+ let logService:LogService;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ LogComponent ]
+ declarations: [ LogComponent ],
+ imports: [HttpClientTestingModule],
+ // providers:[LogService,MockBackend,BaseRequestOptions,{
+ // porvide:Http,useFactory:(backend:MockBackend,defaultOptions:BaseRequestOptions)=>{
+ // return new Http(backend,defaultOptions);
+ // },
+ // deps:[MockBackend,BaseRequestOptions],
+ // }]
})
.compileComponents();
}));
@@ -17,9 +31,30 @@ describe('LogComponent', () => {
fixture = TestBed.createComponent(LogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ logService=TestBed.get(LogService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ describe('should test subscribe',()=>{
+ it('should test ngOnInit method1',()=>{
+ component.reportType = "Dashboard";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("3");
+ })
+ })
+
+ it('should test ngOnInit method2',()=>{
+ component.reportType != "Dashboard";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("7");
+ })
+
+ it('should test subscribe method inside ngOnInit method',()=>{
+ let spy=spyOn(logService,'getLogData').and.returnValue(Observable.of('you object'));
+ component.ngOnInit();
+ expect(spy).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 d693ebc0..c922b359 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
@@ -9,6 +9,7 @@ import { RouterTestingModule } from '@angular/router/testing';
describe('RunReportFormFieldsComponent', () => {
let component: RunReportFormFieldsComponent;
let fixture: ComponentFixture<RunReportFormFieldsComponent>;
+ let formfield =[{"validationType":1},{},{}] ;
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -22,6 +23,7 @@ describe('RunReportFormFieldsComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(RunReportFormFieldsComponent);
component = fixture.componentInstance;
+ component.formFieldList = formfield;
fixture.detectChanges();
});
@@ -31,15 +33,20 @@ describe('RunReportFormFieldsComponent', () => {
it('should test ngOnInit method', () => {
component.ngOnInit();
- expect(component.showSpinner).toEqual(true);
- expect(component.navigateToRun).toEqual(false);
+ // expect(component.showSpinner).toEqual(true);
+ // expect(component.navigateToRun).toEqual(false);
});
- it('should test getQueryString method', () => {
- component.directCallQueryParams !== '';
+ it('should test convertDate method', () => {
+ component.convertDate("test");
+ });
+
+ it('should test getQueryString methods', () => {
+ component.directCallQueryParams = 'abc';
component.getQueryString();
expect(component.getQueryString()).toEqual(component.directCallQueryParams);
- component.directCallQueryParams == '';
+
+ component.directCallQueryParams = "";
component.getQueryString();
expect(component.getQueryString()).toEqual(component.queryString);
});
@@ -57,4 +64,50 @@ describe('RunReportFormFieldsComponent', () => {
expect(component.showLabel).toEqual(component.showLabel);
});
+ it('should test editReport method', () => {
+ component.editReport("test");
+ });
+
+ it('should test runReport method', () => {
+ component.iSDashboardReport = "test";
+ component.formFieldList.length = 1;
+ component.runReport();
+
+ expect(component.hitCnt).toBe(component.hitCnt++);
+ expect(component.reportMode).toBe("FormField");
+ let spy = spyOn(component, 'generateQueryString');
+ component.generateQueryString();
+ expect(component.generateQueryString).toHaveBeenCalled();
+ expect(component.showSpinner).toBe(false);
+
+ component.iSDashboardReport = "test";
+ component.formFieldList.length = 0;
+ component.runReport();
+
+ expect(component.reportMode).toBe("Regular");
+
+ component.iSDashboardReport = "Dashboard";
+ component.runReport();
+ expect(component.showSpinner).toBe(false);
+ expect(component.navigateToRun).toBe(true);
+
+
+ });
+
+ it('should test ngDoCheck method', () =>{
+ component.formFieldList != undefined;
+ component.oldGroupSelectValue = "test";
+ component.groupSelectValue = "testing";
+ component.ngDoCheck();
+
+ expect(component.oldGroupSelectValue).toBe(component.groupSelectValue);
+ });
+
+ it('should test fetchAndPopulateFormFields method', () => {
+ component.fetchAndPopulateFormFields(1, "test");
+ })
+
+ it('should test generateQueryString method',() => {
+ component.generateQueryString();
+ })
}); \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts
index 82eda851..3aa4713f 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.component.spec.ts
@@ -27,8 +27,12 @@ describe('RunComponent', () => {
});
it('should test ngOnInit method', () => {
+ component.reportType = "Dashboard";
+ component.ngOnInit();
+ expect(component.stepNo).toEqual("4");
+
+ component.reportType = "test";
component.ngOnInit();
- component.reportType !== "Dashboard";
expect(component.stepNo).toEqual("8");
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
index 5afbea4b..3c3efb92 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/security/security.component.spec.ts
@@ -30,10 +30,56 @@ describe('SecurityComponent', () => {
});
it('should test ngOnInit method', () => {
- component.reportType === "Dashboard";
+ component.reportType = "Dashboard";
component.ngOnInit();
expect(component.showSpinner).toEqual(true);
+ expect(component.stepNo).toEqual('2');
+
+ component.reportType = "test";
+ component.ngOnInit();
expect(component.stepNo).toEqual('6');
});
+ it('should test addUserEditAccess method', () =>{
+ let reportUserId = 'test';
+ let index = 1;
+ component.userEditAccessArr[1] = true;
+ component.addUserEditAccess(reportUserId, index);
+
+ component.userEditAccessArr[1] = false;
+ component.addUserEditAccess(reportUserId, index);
+
+ });
+
+ it('should test addRoleEditAccess method', () =>{
+ let reportUserId = 'test';
+ let index = 1;
+ component.addRoleEditAccessArr[1] = true;
+ component.addRoleEditAccess(reportUserId, index);
+
+ component.addRoleEditAccessArr[1] = false;
+ component.addRoleEditAccess(reportUserId, index);
+
+ });
+
+ it("should test addReportUser method", () => {
+ component.addReportUser();
+ });
+
+ it("should test removeReportUser method", () => {
+ component.removeReportUser("test");
+ });
+
+ it("should test addReportRole method", () => {
+ component.addReportRole();
+ });
+
+ it("should test removeReportRole method", () => {
+ component.removeReportRole("test");
+ });
+
+ it("should test saveSecurityTabData method", () => {
+ component.saveSecurityTabData();
+ });
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts
index 979b40f2..bf5f7f24 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-error-dialog/sql-validate-error-dialog.component.spec.ts
@@ -2,9 +2,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SQLValidateErrorDialogComponent } from './sql-validate-error-dialog.component';
-describe('ValidateErrorComponentComponent', () => {
+describe('ValidateErrorComponent', () => {
let component: SQLValidateErrorDialogComponent;
let fixture: ComponentFixture<SQLValidateErrorDialogComponent>;
+ let tableobj: any=JSON.stringify({"errormessage":"DummyError","stacktrace":"trace"})
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -16,6 +17,7 @@ describe('ValidateErrorComponentComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(SQLValidateErrorDialogComponent);
component = fixture.componentInstance;
+ component.tableObj=tableobj;
fixture.detectChanges();
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
index 795afc25..c894bff6 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
@@ -6,8 +6,10 @@ import { FormsModule } from '@angular/forms';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { SqlService } from './sql.service';
-import { Observable, of } from 'rxjs';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs/Observable';
import { element } from '@angular/core/src/render3';
+import { environment } from 'src/environments/environment';
describe('SQLComponentComponent', () => {
let sqlService: SqlService;
@@ -43,45 +45,23 @@ describe('SQLComponentComponent', () => {
});
it('should test ngOnInit method', () => {
-
- fixture.detectChanges();
component.ngOnInit();
expect(component.showSaveSQLDialog).toEqual(false);
expect(component.SQLPostResponse).toEqual(true);
expect(component.ValidatePostResponse).toEqual({});
-
- (done: DoneFn)=> {
- sqlService.getSQLTabData("test").subscribe(value => {
- expect(component.showSpinner).toEqual(true);
- expect(component.finalGetObj).toEqual(value);
- expect(component.sqlText).toEqual(component.finalGetObj.query);
- expect(component.showSpinner).toEqual(false);
- done();
- })
- }
-
});
- it('should test ngOnChanges method', () => {
+ it('should test ngOnChanges methods', () => {
fixture.detectChanges();
component.ngOnChanges();
expect(component.showSaveSQLDialog).toEqual(false);
expect(component.SQLPostResponse).toEqual(true);
expect(component.ValidatePostResponse).toEqual({});
-
- sqlService.getSQLTabData("test").subscribe((response) => {
- expect(component.showSpinner).toBe(true);
- expect(component.finalGetObj).toBe(response);
- expect(component.sqlText).toEqual(component.finalGetObj.query);
- expect(component.showSpinner).toEqual(false);
-
- });
-
});
- it('should test saveSQL method', () => {
- component.SQLPostResponse === true;
+ it('should test saveSQL methods if condition', () => {
+ component.SQLPostResponse = true;
component.saveSQL();
expect(component.SQLstatus).toEqual("Success!");
expect(component.SQLmessage).toEqual("Your change has been saved! Definition is updated.");
@@ -90,21 +70,7 @@ describe('SQLComponentComponent', () => {
});
it('should test validate method', () => {
-
- component.validate();
-
- sqlService.postSQLValidateAndSave("test").subscribe((Response) => {
- expect(component.showSpinner).toEqual(true);
- expect(component.ValidateResponseString).toEqual(Response["data"]["elements"]);
- expect(component.ValidatePostResponse).toEqual(JSON.parse(Response["data"]["elements"]));
-
- component.ValidatePostResponse["query"] !== undefined;
-
- expect(component.showModal).toEqual(true);
- expect(component.Validatestatus).toEqual("SQL Test Run - Executed!");
- expect(component.showValidateSQLDialog).toEqual(component.showValidateSQLDialog);
- expect(component.Validateclosable).toEqual(true);
- })
+ component.validate();
});
it('should test closeSaveModal method', () => {
@@ -114,13 +80,18 @@ describe('SQLComponentComponent', () => {
});
it('should test closeValidateModal method', () => {
- component.reportMode === "Create";
- component.Validatestatus == "SQL Test Run - Failed!";
-
+ component.reportMode = "Create";
+ component.Validatestatus = "SQL Test Run - Failed!";
component.closeValidateModal();
expect(component.sqlText).toEqual(component.sqlText);
expect(component.showValidateSQLDialog).toEqual(component.showValidateSQLDialog);
expect(component.Validateclosable).toEqual(false);
+
+ component.reportMode = "Create";
+ component.Validatestatus = "SQL Test Run - Passed!";
+ component.closeValidateModal();
+ expect(component.showValidateSQLDialog).toEqual(component.showValidateSQLDialog);
+ expect(component.Validateclosable).toEqual(false);
});
it('should test SetValidateResponseString method', () => {
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts
index d297fa06..da392424 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts
@@ -1,6 +1,9 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HeaderTabsComponent } from './header-tabs.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RouterTestingModule } from '@angular/router/testing';
describe('MainComponentComponent', () => {
let component: HeaderTabsComponent;
@@ -8,7 +11,9 @@ describe('MainComponentComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ HeaderTabsComponent ]
+ schemas:[CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ HeaderTabsComponent ],
+ imports:[HttpClientTestingModule,RouterTestingModule]
})
.compileComponents();
}));
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts
index 60f464b8..9cd37313 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-wrapper-component/header-tabs-wrapper.component.spec.ts
@@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HeaderTabsWrapperComponent } from './header-tabs-wrapper.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { RouterTestingModule } from '@angular/router/testing';
describe('ReportsComponentComponent', () => {
let component: HeaderTabsWrapperComponent;
@@ -8,7 +10,9 @@ describe('ReportsComponentComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ HeaderTabsWrapperComponent ]
+ declarations: [ HeaderTabsWrapperComponent ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ imports:[RouterTestingModule]
})
.compileComponents();
}));
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 359bee9f..2c01ff14 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
@@ -93,5 +93,14 @@ describe('ReportListComponent', () => {
component.close();
expect(component.showDialog).toEqual(true);
expect(component.closable).toEqual(false);
- })
+ });
+
+ it('should test deleteReport method', () => {
+ component.deleteReport();
+ });
+
+ it('should test openReportSchedule method', () => {
+ component.openReportSchedule("test");
+ });
+
}); \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts
index d87afceb..7481acc8 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts
@@ -46,10 +46,14 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { MatTableModule, MatSelectModule, MatSlideToggleModule } from '@angular/material';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { UserService } from 'src/app/shared/services/user/user.service';
+import { Observable } from 'rxjs';
describe('SelfComponent', () => {
let component: SelfComponent;
let fixture: ComponentFixture<SelfComponent>;
+ let userService:UserService;
+ let tableobj:any=JSON.stringify({"errormessage":"DummyError","stacktrace":"trace"});
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -72,9 +76,19 @@ describe('SelfComponent', () => {
fixture = TestBed.createComponent(SelfComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ userService=TestBed.get(UserService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ describe('should test ngOnInit method',()=>{
+ it('should test subscribe',()=>{
+ let spy=spyOn(userService,'getFunctionalMenuStaticDetailSession').and.returnValue(Observable.of('you object'));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
+ })
+
});