reference-dataform.component- added test case 11/66011/2
authorArundathi Patil <arundpil@in.ibm.com>
Wed, 12 Sep 2018 08:14:56 +0000 (13:44 +0530)
committerTakamune Cho <tc012c@att.com>
Sun, 16 Sep 2018 11:15:48 +0000 (11:15 +0000)
wrote test case to test and cover validateDataAndSaveToAppc() function

Issue-ID: APPC-1064
Change-Id: I35651401b8065284b7616e8519095d259c170f93
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts

index 499de2a..fa8ed1a 100644 (file)
@@ -1128,6 +1128,28 @@ describe('ReferenceDataformComponent', () => {
         expect(component.vnfcIdentifier).toBe(true);
     }));
 
+    it('should test validateDataAndSaveToAppc function', ()=>{
+        component.tempAllData = [{
+            action: "Configure",
+            scope: {
+                'vnf-type': "testVnf"
+            }
+        },{
+            action: "StartApplication",
+            scope: {
+                'vnf-type': "testVnf"
+            }
+        }
+    ];
+        component.actionChanged = true;
+        component.currentAction = 'Config';
+        let spy = spyOn(ReferenceDataformComponent.prototype, 'populateExistinAction');
+        component.validateDataAndSaveToAppc(true, {}, {});
+        expect(spy).toHaveBeenCalled();
+        expect(component.referenceDataObject.action).toBe('Config')
+    });
+
+
     // afterEach(function() {
     //     jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
     // });