summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-04-01 13:49:43 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-01 13:49:43 +0000
commit6619a1ef446cf9ab5976b8bedb15b5b86af4032b (patch)
tree17f33ed86d46b52a4e309094c994ea8b31363cfd /ecomp-sdk/epsdk-app-overlay
parent13758cf841eda6ab5c2c7b7ffa204ee42f298644 (diff)
parentf2e1efeb586011b9a0d9d3cfe10858b9d07ac229 (diff)
Merge "added some test cases for sql comp"
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.ts33
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();
+// });
+
});