the upgrade button is allowed when VFM in instance not exists in model.

Issue-ID: VID-758
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Change-Id: I8f5aceaf27480d6cc3ab6ec630bcaf285b683303
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
index 3499377..dc4c2d3 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
@@ -400,10 +400,10 @@
     [true, false, true, true],
     [true, false, false, false],
   ]).
-  test('when flag is %s the UpdatedLatestVersion is %s and Vfmodule CustomizationUuid Differ is %s isShouldShowButtonGenericMustToBeCalled should return %s', (
+  test('when flag is %s the UpdatedLatestVersion is %s and Vfmodule not exists on hierarchy is %s isShouldShowButtonGenericMustToBeCalled should return %s', (
      flag: boolean,
      isThereAnUpdatedLatestVersion: boolean,
-     isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDiffer: boolean,
+     isVfModuleCustomizationIdNotExistsOnModel: boolean,
      isShouldShowButtonGenericMustToBeCalled: boolean
      ) => {
       let node = <any>  {};
@@ -416,11 +416,47 @@
         }
       });
       spyOn(service, 'isThereAnUpdatedLatestVersion').and.returnValue(isThereAnUpdatedLatestVersion);
-      spyOn(service, 'isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDiffer').and.returnValue(isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDiffer);
+      spyOn(service, 'isVfModuleCustomizationIdNotExistsOnModel').and.returnValue(isVfModuleCustomizationIdNotExistsOnModel);
 
       expect(service.isVfMoudleCouldBeUpgraded(node, serviceModelId)).toEqual(isShouldShowButtonGenericMustToBeCalled);
     });
 
+  each([
+    ['Vfm customization uuid not exists in model', 'not-existing-customization-uuid', 'service-model-id', true],
+    ['Vfm customization uuid exists in model', 'existing-customization-uuid', 'service-model-id', false]
+  ]).
+  test('%s when vfModuleNode is  %s and serviceModelId is %s ', (
+    description,
+    modelCustomizationId,
+    serviceModelId: string,
+    isExistsOnHierarchy: boolean,
+    ) => {
+
+    const vfModuleNode = { data: {
+        modelCustomizationId : modelCustomizationId
+      }};
+
+    jest.spyOn(store, 'getState').mockReturnValue(<any>{
+      service : {
+        "serviceHierarchy": {
+          [serviceModelId]: {
+            "vfModules": {
+              "module-1": {
+                "customizationUuid": "3d7f41c8-333b-4fee-b50d-5687e9c2170f",
+              },
+              "module-2": {
+                "customizationUuid": "existing-customization-uuid",
+              }
+            }
+          }
+        }
+      }
+    });
+    expect(service.isVfModuleCustomizationIdNotExistsOnModel(vfModuleNode, serviceModelId)).toEqual(isExistsOnHierarchy);
+
+
+  });
+
 });
 
 function getStore() {