diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main')
11 files changed, 79 insertions, 82 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 1253b2be..bd9bea48 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 @@ -91,12 +91,6 @@ describe('HeaderComponent', () => { expect(component).toBeTruthy(); }); - it('testing if condition in ngOnInit method',()=>{ - component.cookieService.set('show_app_header','false'); - component.ngOnInit(); - expect(component.showHeader).toBe(false) - }) - describe('should test ngOnInit',()=>{ it('should validate on ngOnInit',()=>{ let spy=spyOn(headerService, 'getTopMenuItems').and.returnValue(Observable.of('you object')); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts index 42c176bf..9bbcfc4e 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts @@ -90,13 +90,6 @@ describe('SidebarComponent', () => { expect(component).toBeTruthy(); }); - it('testing if condition in ngOnInit method',()=>{ - component.cookieService.set('show_app_header','false'); - component.ngOnInit(); - expect(component.showHeader).toBe(false) - }) - - describe('should test ngOnInit',()=>{ it('should validate on ngOnInit',()=>{ let spy=spyOn(sidebarService,'getLeftMenu').and.returnValue(Observable.of(stubData1)); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts index 975f72c3..4bc9f5dc 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts @@ -78,12 +78,6 @@ describe('LayoutComponent', () => { expect(component).toBeTruthy(); }); - it('testing if condition in ngOnInit method',()=>{ - component.cookieService.set('show_app_header','false'); - component.ngOnInit(); - expect(component.showHeader).toBe(false) - }) - it('should test receiveCollapsed method',()=>{ component.receiveCollapsed(true); expect(component.collapedSideBar).toBe(true); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts index 8d5c6637..e2b4c720 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts @@ -69,10 +69,6 @@ describe('MenusService', () => { expect(component).toBeTruthy(); }); - // it('should test getTotalRowCount method',()=>{ - // component.getTotalRowCount(); - // }) - it('should test updateStatus method',()=>{ component['updateStatus']('N'); }) 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 11daaf84..85f62164 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 @@ -113,10 +113,6 @@ describe('RolesComponent', () => { expect(spy).toHaveBeenCalled(); }) - it('should test getRole method',()=>{ - component.getRole("value"); - }) - it('should test delRoleConfirmPopUp method',()=>{ component.delRoleConfirmPopUp('dummyargument'); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column.service.spec.ts index 22e1cc3d..e663001a 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column.service.spec.ts @@ -12,9 +12,6 @@ describe('ColumnService', () => { imports: [HttpClientTestingModule] })); - // httpClient=TestBed.get(HttpClient); - // httpTestingController=TestBed.get(httpTestingController); - it('should be created', () => { const service: ColumnService = TestBed.get(ColumnService); expect(service).toBeTruthy(); 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 e2b08a4f..af8e9db7 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 @@ -16,13 +16,7 @@ describe('LogComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ LogComponent ], - imports: [HttpClientTestingModule], - // providers:[LogService,MockBackend,BaseRequestOptions,{ - // porvide:Http,useFactory:(backend:MockBackend,defaultOptions:BaseRequestOptions)=>{ - // return new Http(backend,defaultOptions); - // }, - // deps:[MockBackend,BaseRequestOptions], - // }] + imports: [HttpClientTestingModule] }) .compileComponents(); })); 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 a1906c85..54df7d82 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 @@ -19,7 +19,9 @@ describe('RunReportFormFieldsComponent', () => { { baseUrl: 'just for testing' } - ] + ]; + var responseFormFieldGroups={"formFieldGroupsJSON":'{"Indrijeet":"kumar"}'}; + var respObj={"formFieldList":{"value1":"value1"}}; beforeEach(async(() => { TestBed.configureTestingModule({ @@ -30,12 +32,9 @@ describe('RunReportFormFieldsComponent', () => { }) .compileComponents(); runService = TestBed.get(RunService); - // spyOn(runService, 'getReportData').and.returnValue(Observable.of(environment)); - // spyOn(runService, 'getReportDataWithFormFields').and.returnValue(Observable.of(environment)); spyOn(runService, 'getDefinitionPageDetails').and.returnValue(Observable.of(environment)); spyOn(runService, 'refreshFormFields').and.returnValue(Observable.of(environment)); - // spyOn(runService, 'downloadReportExcel').and.returnValue(Observable.of(environment)); - spyOn(runService, 'getFormFieldGroupsData').and.returnValue(Observable.of(environment)); + })); beforeEach(() => { @@ -127,11 +126,10 @@ describe('RunReportFormFieldsComponent', () => { expect(component.ngOnInit).toHaveBeenCalled(); }); -// it('should test fetchAndPopulateFormFields method', () => { -// spyOn(component, 'fetchAndPopulateFormFields').and.callThrough(); -// component.formFieldGroupObjList = null; -// component.fetchAndPopulateFormFields(1, "test"); -// expect(component.fetchAndPopulateFormFields).toHaveBeenCalled(); -// }); + it('should test fetchAndPopulateFormFields method', () => { + component.formFieldGroupObjList=[{"formFieldList":"formFieldList"}] + spyOn(runService, 'getFormFieldGroupsData').and.returnValue(Observable.of(responseFormFieldGroups)); + component.fetchAndPopulateFormFields(respObj,"value2"); + }); });
\ 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-report-result-set/run-report-result-set.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts index 44765d49..fa856c00 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts @@ -6,12 +6,21 @@ import { MatTableModule } from '@angular/material/table'; import { RunReportResultSetComponent } from './run-report-result-set.component'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { HttpClient } from '@angular/common/http'; import { RouterTestingModule } from '@angular/router/testing'; +import { RunService } from '../run.service'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/catch'; +import 'rxjs/add/observable/throw'; describe('RunReportResultSetComponent', () => { let component: RunReportResultSetComponent; let fixture: ComponentFixture<RunReportResultSetComponent>; + let _runService:RunService; + var response={ + "reportDataColumns":[{"columnTitle":"columnTitle"}], + "reportDataRows":[{"colId":"colId"}] + } beforeEach(async(() => { TestBed.configureTestingModule({ @@ -31,9 +40,26 @@ describe('RunReportResultSetComponent', () => { fixture = TestBed.createComponent(RunReportResultSetComponent); component = fixture.componentInstance; fixture.detectChanges(); + _runService=TestBed.get(RunService); }); it('should compile', () => { expect(component).toBeTruthy(); }); + + it('should test ngOnInit method',()=>{ + component.reportId1="reportId1"; + let spy=spyOn(_runService,'getReportData').and.returnValue(Observable.of(response)); + component.ngOnInit(); + expect(spy).toHaveBeenCalled(); + + }) + + it('should test ngAfterViewInit method',()=>{ + component.reportId1="reportId1"; + let spy=spyOn(_runService,'getReportData').and.returnValue(Observable.of(response)) + component.ngAfterViewInit(); + 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/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 a41b11cd..2aeac4a2 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 @@ -2,10 +2,10 @@ 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, MatTableDataSource } from '@angular/material/table'; +import { MatTableModule} from '@angular/material/table'; -import { RunReportComponent, PeriodicElement } from './run-report.component'; -import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SimpleChange, SimpleChanges } from '@angular/core'; +import { RunReportComponent} from './run-report.component'; +import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SimpleChanges } from '@angular/core'; import { MatMenuModule } from '@angular/material'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { RouterTestingModule } from '@angular/router/testing'; @@ -24,13 +24,12 @@ describe('RunReportComponent', () => { let runService : RunService; let options1 = {}; let dashboard; - let dashboard2; let responseformfield = 1; let environment = [ { baseUrl: 'just a link' } - ] + ]; beforeEach(async(() => { @@ -49,13 +48,10 @@ describe('RunReportComponent', () => { providers: [RunService] }).compileComponents(); runService = TestBed.get(RunService); - //spyOn(runService, 'getReportDataWithFormFields').and.returnValue(Observable.of(environment)); - //spyOn(runService, 'getReportData').and.returnValue(Observable.of(environment)); spyOn(runService, 'downloadReportExcel').and.returnValue(Observable.of(environment)); })); beforeEach(() => { - //dashboard = {"item":{"hasContent":{"name":"rupi","id":"check#check"}}}; fixture = TestBed.createComponent(RunReportComponent); runService = TestBed.get(RunService); component = fixture.componentInstance; @@ -107,6 +103,7 @@ describe('RunReportComponent', () => { expect(component.NEWdisplayedColumns).toEqual(new Array()); }); + it('should test showError method', () => { let errmsg = "errormessage"; let stcktrace = "stacktrace"; @@ -148,40 +145,40 @@ describe('RunReportComponent', () => { it('should test the ngOnChanges first If condition', () => { change = {}; + component.queryString="queryString"; + component.reportId1="reportId1"; + var response={"errormessage":true} component.reportMode !== "Regular" component.initCnt = 1; component.TriggerFFArr.length = 0; + let spy=spyOn(runService,'getReportDataWithFormFields').and.returnValue(Observable.of(response)); component.ngOnChanges(change); - expect(component.showMoreVert).toEqual(false); + expect(spy).toHaveBeenCalled(); expect(component.initCnt).toEqual(1); expect(component.showDashboardReport).toEqual(false); expect(component.displayedRowObj).toEqual(new Array()); expect(component.displayedColumns).toEqual(new Array()); expect(component.formFieldList).toEqual(new Array()); - expect(component.showSpinner).toEqual(true); expect(component.NEWdisplayedColumns).toEqual(new Array()); expect(component.isReady).toEqual(false); + }); + it('should test initialProcess method', () => { component.DashboardReportObj.length = 1; component.initialProcesses(); }); - // it('should test postFetchingReportDataFn method', () => { - // let response: any; - // component.postFetchingReportDataFn(response); - // }) - - // it('should test ngOnChanges subscribe method', () => { - // spyOn(component, 'ngOnChanges').and.callThrough(); - // component.ngOnChanges(change); - // expect(component.ngOnChanges).toHaveBeenCalled(); + // it('should test postFetchingReportDataFn method',()=>{ + // var response={ + // "reportName":"reportName", + // "reportDataColumns":[{"columnTitle":"columnTitle","colId":"colId"}], + // "reportDataRows":[{"value":"value"}] + // } + // component.displayedColumnsArr=["string"] + // component.postFetchingReportDataFn(response) // }) - // it('should test postFetchingReportDataFn method', () => { - // let obj: any; - // component.postFetchingReportDataFn(obj); - // }) - + }); 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 52082c9f..68085b1e 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 @@ -16,7 +16,6 @@ describe('SQLComponentComponent', () => { let fixture: ComponentFixture<SQLComponent>; const reportId = "test"; const finalGetObj = {"query":"dummyQuery"}; - let elements = []; let environment = [ { "baseUrl": 'just for test' @@ -32,9 +31,7 @@ describe('SQLComponentComponent', () => { }) .compileComponents(); sqlService = TestBed.get(SqlService); - let response : any; spyOn(sqlService, 'getSQLTabData').and.returnValue(Observable.of(environment)); - spyOn(sqlService, 'postSQLValidateAndSave').and.returnValue(Observable.of(environment)); })); beforeEach(() => { @@ -82,6 +79,27 @@ describe('SQLComponentComponent', () => { expect(component.SQLclosable).toEqual(true); }); + it('should test saveSQL method else condition',()=>{ + component.SQLPostResponse = false; + component.saveSQL(); + }) + + it('should test validate method',()=>{ + component.sqlText="sqlText"; + var response={"data":{"elements":'{"elements":""}'}} + let spy=spyOn(sqlService,'postSQLValidateAndSave').and.returnValue(Observable.of(response)) + component.validate(); + expect(spy).toHaveBeenCalled(); + }) + + it('should test validate method',()=>{ + component.sqlText="sqlText"; + var response={"data":{"elements":'{"query":"query"}'}} + let spy=spyOn(sqlService,'postSQLValidateAndSave').and.returnValue(Observable.of(response)) + component.validate(); + expect(spy).toHaveBeenCalled(); + }) + it('should test closeSaveModal method', () => { component.closeSaveModal(); expect(component.showSaveSQLDialog).toEqual(component.showSaveSQLDialog); @@ -113,10 +131,4 @@ describe('SQLComponentComponent', () => { expect(component.GetValidateResponseString()).toEqual("test"); }); -// it('should test validate method', () => { -// spyOn(component, 'validate').and.callThrough(); -// component.validate(); -// expect(component.validate).toHaveBeenCalled(); -// }); - }); |