diff options
author | Lorraine Welch <lb2391@att.com> | 2020-05-04 16:19:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-05-04 16:19:15 +0000 |
commit | 03abc05e6217274f557ec4987aa8e8bd34b2f4a4 (patch) | |
tree | dc7c5ab5e07bc22a6c9ac1b03960db129cbe6d3e | |
parent | 25a5a2d0d5e65d359d85412b28e230aa1c76f8bc (diff) | |
parent | 19382d6fe3a4ee18d5dc234e29cfbcb0af7d5977 (diff) |
Merge "some test cases in definition component"
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts | 20 |
1 files changed, 14 insertions, 6 deletions
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 93636519..cffd5290 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,4 +1,5 @@ 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'; @@ -18,7 +19,7 @@ describe('DefinitionComponent', () => { "reportId":123, "reportName":"reportName", "reportDescr":"reportDescr", - "reportType":"reportType", + "reportType":"Linear", "dbInfo":"dbInfo", "formHelpText":"formHelpText", "repDefType":"repDefType", @@ -44,7 +45,8 @@ describe('DefinitionComponent', () => { "weeklyRec":true, "monthlyRec":true, "dashboardLayoutJSON":'"data"', - "dashboardLayoutHTML":"dashboardLayoutHTML" + "dashboardLayoutHTML":"dashboardLayoutHTML", + "displayArea":{"selected":true} } beforeEach(async(() => { @@ -74,19 +76,25 @@ describe('DefinitionComponent', () => { }); it('should test ngOnInit method',()=>{ - var params={ - "reportId":100 - }; component.IncomingReportId=-1; component.reportMode="Create"; - //spyOn(activatedRoute,'params').and.returnValue(Observable.of(params)); let spy=spyOn(_definitionService,'getDefinitionPageDetails').and.returnValue(Observable.of(response)); component.ngOnInit(); expect(spy).toHaveBeenCalled(); + expect(_definitionService.getDefinitionPageDetails).toHaveBeenCalled(); expect(component.isEdit).toBe(true); expect(component.showDialog).toBe(false); }); + it('should test ngOnInit method',()=>{ + component.IncomingReportId=1; + component.reportMode="Edit"; + let spy=spyOn(_definitionService,'getDefinitionPageDetails').and.returnValue(Observable.of(response)); + component.ngOnInit(); + expect(spy).toHaveBeenCalled(); + expect(_definitionService.getDefinitionPageDetails).toHaveBeenCalled(); + }); + it('should test first if condition in saveDefinitionInfo method',()=>{ component.IncomingReportId=-1; component.reportMode="Create"; |