diff options
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(); +// }); + }); |