summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2018-09-04 14:16:51 +0530
committerTakamune Cho <tc012c@att.com>2018-09-04 19:02:26 +0000
commitd24453b1f0982763ceb5c52f7057899dfd6852c3 (patch)
treed217191d02e4967ef4394a90d897f0175df30212 /src/app
parent7233ac70a2b90a581f6cdab4060eb7dfcb23a426 (diff)
utility.service.spec.ts : added test case
added test case to cover the condition when artifact-type is reference-data in createPayLoadForSave() function. Issue-ID: APPC-1064 Change-Id: I48b799c527cb93a1e186e6f649dc298ad1d0a90c Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/shared/services/utilityService/utility.service.spec.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/app/shared/services/utilityService/utility.service.spec.ts b/src/app/shared/services/utilityService/utility.service.spec.ts
index c0cdb13..6523447 100644
--- a/src/app/shared/services/utilityService/utility.service.spec.ts
+++ b/src/app/shared/services/utilityService/utility.service.spec.ts
@@ -110,4 +110,28 @@ describe('UtilityService', () => {
expect(spy).toHaveBeenCalled();
}));
+
+ it('should test createPayLoadForSave function', inject([UtilityService], (service: UtilityService) => {
+ let artifactContent = {data: 'data'};
+ let artifactType = 'reference_data';
+ let vnfType = 'vnf-type';
+ let action = 'config';
+ let fileName = 'referencedata.json';
+ let versionNo = 180;
+ localStorage.setItem('apiToken', 'dshagsa');
+ localStorage.setItem('userId', 'abc');
+ let newPayload='{"userID": "' + 'abc' + '","vnf-type" : "' + vnfType + '","action" : "AllAction","artifact-name" : "' + fileName.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '","artifact-type" : "APPC-CONFIG","artifact-version" : "0.1","artifact-contents" :" ' + artifactContent + '"}';
+ let data =
+ {
+ "input": {
+ "design-request": {
+ "request-id": 'dshagsa',
+ "action": "uploadArtifact",
+ "payload": newPayload
+
+ }
+ }
+ }
+ let payload = service.createPayLoadForSave(artifactType, vnfType, action, fileName, versionNo, artifactContent);
+ }));
}); \ No newline at end of file