Utility service : added test case
Wrote test cases to cover checkNotNull function in utility service.
Issue-ID: APPC-1064
Change-Id: Icb9dc8872634e8772349e1bbbb7f15f39d292aec
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
diff --git a/src/app/shared/services/utilityService/utility.service.spec.ts b/src/app/shared/services/utilityService/utility.service.spec.ts
index 4054a89..80bedeb 100644
--- a/src/app/shared/services/utilityService/utility.service.spec.ts
+++ b/src/app/shared/services/utilityService/utility.service.spec.ts
@@ -81,4 +81,14 @@
let result = { output: {status: {code: '400'}}};
service.processApiSubscribe(result, 'uploadArtifact', '');
}));
+
+ it('should test checkNotNull function to return false on undefined object', inject([UtilityService], (service: UtilityService) => {
+ let obj;
+ expect(service.checkNotNull(obj)).toBe(false);
+ }));
+
+ it('should test checkNotNull function to return true on defined objects', inject([UtilityService], (service: UtilityService) => {
+ let obj = [{data : 'data'}];
+ expect(service.checkNotNull(obj)).toBe(true);
+ }));
});