diff options
author | Rupinder <rupinsi1@in.ibm.com> | 2020-03-26 21:47:38 +0530 |
---|---|---|
committer | Rupinderjeet Singh <rupinsi1@in.ibm.com> | 2020-04-01 09:55:11 +0000 |
commit | f2e1efeb586011b9a0d9d3cfe10858b9d07ac229 (patch) | |
tree | 43b8f1ccffe69757decbf7f33da740faeae50ab8 /ecomp-sdk/epsdk-app-overlay | |
parent | c69a85ad86fd8c1050b0758a241a4a4b1931e432 (diff) |
added some test cases for sql comp
Added more test cases for sql.component.spec.ts
Issue-ID: PORTAL-834
Change-Id: I4ff8536131db78c379286898e5dadb5240846b75
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts | 33 |
1 files changed, 24 insertions, 9 deletions
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 c894bff6..52082c9f 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 @@ -8,15 +8,20 @@ import { RouterTestingModule } from '@angular/router/testing'; import { SqlService } from './sql.service'; 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; let component: SQLComponent; let fixture: ComponentFixture<SQLComponent>; const reportId = "test"; - const finalGetObj = {"query":"dummyQuery"} + const finalGetObj = {"query":"dummyQuery"}; + let elements = []; + let environment = [ + { + "baseUrl": 'just for test' + } + ] beforeEach(async(() => { TestBed.configureTestingModule({ @@ -27,15 +32,17 @@ 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(() => { - fixture = TestBed.createComponent(SQLComponent); + fixture = TestBed.createComponent(SQLComponent); component = fixture.componentInstance; component.reportId1 = reportId; component.finalGetObj = finalGetObj; - sqlService = TestBed.get(SqlService); fixture.detectChanges(); }); @@ -44,6 +51,12 @@ describe('SQLComponentComponent', () => { expect(component).toBeTruthy(); }); + it('should test ngOninit subscribe method', () => { + spyOn(component, 'ngOnInit').and.callThrough(); + component.ngOnInit(); + expect(component.ngOnInit).toHaveBeenCalled(); + }); + it('should test ngOnInit method', () => { component.ngOnInit(); expect(component.showSaveSQLDialog).toEqual(false); @@ -69,10 +82,6 @@ describe('SQLComponentComponent', () => { expect(component.SQLclosable).toEqual(true); }); - it('should test validate method', () => { - component.validate(); - }); - it('should test closeSaveModal method', () => { component.closeSaveModal(); expect(component.showSaveSQLDialog).toEqual(component.showSaveSQLDialog); @@ -104,4 +113,10 @@ describe('SQLComponentComponent', () => { expect(component.GetValidateResponseString()).toEqual("test"); }); +// it('should test validate method', () => { +// spyOn(component, 'validate').and.callThrough(); +// component.validate(); +// expect(component.validate).toHaveBeenCalled(); +// }); + }); |