summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-04-29 10:47:00 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-29 10:47:00 +0000
commit6db20c37bd0fcfe65c6ff8dfa5f93caf95515547 (patch)
tree1fade32bcdbfb1ceea6176a0275e0ee31e680496 /ecomp-sdk
parent61b016eb66b58118daf79e8361182b13bab2b856 (diff)
parent58dab1bc661b4f99b4530a0d8d9fe6980f8ff3d8 (diff)
Merge "some test cases in sql component"
Diffstat (limited to 'ecomp-sdk')
-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();
-// });
-
});