summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts30
1 files changed, 21 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 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();
-// });
-
});