summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-04-29 00:52:21 +0530
committerIndrijeet kumar <indriku1@in.ibm.com>2020-04-29 00:52:40 +0530
commit58dab1bc661b4f99b4530a0d8d9fe6980f8ff3d8 (patch)
tree632eb80a6ce08208c1b916c432b52e26e8a410ba /ecomp-sdk/epsdk-app-overlay/src
parentdb6c63ebfcce75b364ac46fbf66d800aab2fa652 (diff)
some test cases in sql component
some test cases in sql component Issue-ID: PORTAL-813 Change-Id: I921f391346af0d02a707b2b87ae3b11424a02881 Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
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();
-// });
-
});