Merge "Shallow render generic components"
authorJames Forsyth <jf2512@att.com>
Thu, 15 Aug 2019 14:01:14 +0000 (14:01 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 15 Aug 2019 14:01:14 +0000 (14:01 +0000)
pom.xml
src/app/tierSupport/TierSupportActions.js
test/app/MainScreenWrapperActionHelper.test.js [new file with mode: 0644]
test/app/configurableViews/ConfigurableViewReducer.test.js
test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js
test/app/tierSupport/TierSupportActions.test.js
version.properties

diff --git a/pom.xml b/pom.xml
index 422b04f..725d77f 100644 (file)
--- a/pom.xml
+++ b/pom.xml
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onap.oparent</groupId>
+        <artifactId>oparent</artifactId>
+        <version>2.0.0</version>
+    </parent>
     <groupId>org.onap.aai</groupId>
     <artifactId>sparky-fe</artifactId>
     <packaging>war</packaging>
-    <version>1.4.0-SNAPSHOT</version>
+    <version>1.5.1-SNAPSHOT</version>
     <name>aai-sparky-fe</name>
     <url>http://maven.apache.org</url>
 
                             <goal>npm</goal>
                         </goals>
                         <phase>generate-resources</phase>
+                        <configuration>
+                           <!-- optional: The default argument is actually
+                                "install", so unless you need to run some other npm command,
+                                you can remove this whole <configuration> section.
+                           -->
+                           <arguments>install -ddd</arguments>
+                        </configuration>
+                       
                     </execution>
                     <execution>
                         <id>gulp build</id>
                 </executions>
             </plugin>
             <plugin>
-                <groupId>org.sonatype.plugins</groupId>
-                <artifactId>nexus-staging-maven-plugin</artifactId>
-                <version>1.6.7</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <nexusUrl>${nexusproxy}</nexusUrl>
-                    <stagingProfileId>176c31dfe190a</stagingProfileId>
-                    <serverId>ecomp-staging</serverId>
-                </configuration>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-deploy-plugin</artifactId>
             </plugin>
         </plugins>
     </build>
index 08e4e30..69370fa 100644 (file)
@@ -183,8 +183,10 @@ export function querySelectedNodeElement(
   }
 
   return dispatch => {
-    dispatch(setBusyFeedback());
-    dispatch(fetchSelectedNodeElement(selectedNodeFetchRequest));
+    return Promise.all([
+      dispatch(setBusyFeedback()),
+      dispatch(fetchSelectedNodeElement(selectedNodeFetchRequest))
+    ]);
   };
 }
 
diff --git a/test/app/MainScreenWrapperActionHelper.test.js b/test/app/MainScreenWrapperActionHelper.test.js
new file mode 100644 (file)
index 0000000..011010e
--- /dev/null
@@ -0,0 +1,132 @@
+import configureStore from 'redux-mock-store';
+import thunk from 'redux-thunk'
+import {
+  windowResize,
+  showMainMenu,
+  extensibleViewMessageCallback,
+  clearExtensibleViewData,
+  setSecondaryTitle
+} from 'app/MainScreenWrapperActionHelper';
+import {
+  getSetGlobalMessageEvent,
+  getClearGlobalMessageEvent
+} from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions';
+import {
+  globalInlineMessageBarActionTypes
+} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants';
+import {aaiActionTypes} from 'app/MainScreenWrapperConstants';
+
+const mockStore = configureStore([thunk]);
+
+describe('MainScreenWrapperActionHelper', () => {
+  let store;
+
+  beforeEach(() => {
+    store = mockStore({ tierSupportReducer: {} });
+  });
+
+  describe('windowResize', () => {
+    it('emits action', () => {
+      // Given
+      const expectedActions = [{
+        type: aaiActionTypes.AAI_WINDOW_RESIZE
+      }];
+
+      // When
+      store.dispatch(windowResize());
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+  });
+
+  describe('showMainMenu', () => {
+    it('emits action with payload', () => {
+      // Given
+      const input = "testInput";
+      const expectedActions = [{
+        type: aaiActionTypes.AAI_SHOW_MENU,
+        data: {
+          showMenu: input
+        }
+      }];
+
+      // When
+      store.dispatch(showMainMenu(input));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+  });
+
+  describe('extensibleViewMessageCallback', () => {
+    const msgSeverity = "msgSeverity";
+
+    it('emits action with payload when msgText is not blank', () => {
+      // Given
+      const msgText = "msgText";
+      const expectedActions = [{
+        type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
+        data: {
+          msgText: msgText,
+          msgSeverity: msgSeverity
+        }
+      }];
+
+      // When
+      store.dispatch(extensibleViewMessageCallback(msgText, msgSeverity));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+
+    it('emits action when msgText is blank', () => {
+      // Given
+      const msgText = "";
+      const expectedActions = [{
+        type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
+
+      }];
+
+      // When
+      store.dispatch(extensibleViewMessageCallback(msgText, msgSeverity));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+  });
+
+  describe('clearExtensibleViewData', () => {
+    it('emits action with payload', () => {
+      // Given
+      const expectedActions = [{
+        type: aaiActionTypes.EXTENSIBLE_VIEW_NETWORK_CALLBACK_CLEAR_DATA,
+        data: {}
+      }];
+
+      // When
+      store.dispatch(clearExtensibleViewData());
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+  });
+
+  describe('setSecondaryTitle', () => {
+    it('emits action with payload', () => {
+      // Given
+      const title = "testTitle";
+      const expectedActions = [{
+        type: aaiActionTypes.SET_SECONDARY_TITLE,
+        data: title
+      }];
+
+      // When
+      store.dispatch(setSecondaryTitle(title));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+  });
+
+});
index 0c5c46e..53e8b89 100644 (file)
@@ -4,6 +4,7 @@ import {
 import ConfigurableViewReducer from 'app/configurableViews/ConfigurableViewReducer.js'
 describe('ConfigurableViewsReducerTests', () => {
   it('Action Type: CONFIGURABLE_VIEWS_CONFIG_RECEIVED', () => {
+    // Given
     const data = {
       viewId: 'someViewId',
       viewName: 'Some View Name',
@@ -14,13 +15,18 @@ describe('ConfigurableViewsReducerTests', () => {
       data: data
     };
     let state = {};
+
+    // When
     state = ConfigurableViewReducer(state, action);
+
+    // Then
     expect(state).toEqual({
       configurableViewsConfig: data
     });
   });
 
   it('Action Type: CUSTOM_COMPONENTS_RECEIVED', () => {
+    // Given
     const data = {
       componentName: 'someComponentName',
       componentData: {
@@ -33,22 +39,46 @@ describe('ConfigurableViewsReducerTests', () => {
       data: data
     };
     let state = {};
+
+    // When
     state = ConfigurableViewReducer(state, action);
+
+    // Then
     expect(state).toEqual({
       customComponents: data
     });
   });
 
   it('Action Type: CUSTOM_ROUTES', () => {
+    // Given
     const data = 'some/custom/route';
     const action = {
       type: configurableViewsActionTypes.CUSTOM_ROUTES,
       data: data
     };
     let state = {};
+
+    // When
     state = ConfigurableViewReducer(state, action);
+
+    // Then
     expect(state).toEqual({
       customRoutes: data
     });
   });
-})
+
+  it('Action Type: unknown', () => {
+    // Given
+    const action = {
+      type: "TestUnknownType",
+      data: "TestData"
+    };
+    let state = {};
+
+    // When
+    state = ConfigurableViewReducer(state, action);
+
+    // Then
+    expect(state).toEqual(state);
+  });
+});
index 62389b4..bbcb7c1 100644 (file)
@@ -1,13 +1,14 @@
-import GlobalInlineMessageBarReducer from 'app/globalInlineMessageBar/GlobalInlineMessageBarReducer.js';
+import GlobalInlineMessageBarReducer from 'app/globalInlineMessageBar/GlobalInlineMessageBarReducer';
 import {
   globalInlineMessageBarActionTypes
-} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants.js';
+} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants';
 import {
   MESSAGE_LEVEL_WARNING
-} from 'utils/GlobalConstants.js'
+} from 'utils/GlobalConstants'
 
 describe('GlobalInlineMessageBarReducerTests', () => {
   it('Action Type: SET_GLOBAL_MESSAGE', () => {
+    // Given
     const action = {
       type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
       data: {
@@ -16,7 +17,11 @@ describe('GlobalInlineMessageBarReducerTests', () => {
       }
     };
     let state = {};
+
+    // When
     state = GlobalInlineMessageBarReducer(state, action);
+
+    // Then
     expect(state).toEqual({
       feedbackMsgText: action.data.msgText,
       feedbackMsgSeverity: action.data.msgSeverity
@@ -24,6 +29,7 @@ describe('GlobalInlineMessageBarReducerTests', () => {
   });
 
   it('Action Type: CLEAR_GLOBAL_MESSAGE', () => {
+    // Given
     const action = {
       type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
     };
@@ -31,10 +37,31 @@ describe('GlobalInlineMessageBarReducerTests', () => {
       feedbackMsgText: 'some error message here',
       feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
     };
+
+    // When
     state = GlobalInlineMessageBarReducer(state, action);
+
+    // Then
     expect(state).toEqual({
       feedbackMsgText: '',
       feedbackMsgSeverity: ''
     });
   });
-})
+
+  it('Action Type: unknown', () => {
+    // Given
+    const action = {
+      type: "TestUnknownType"
+    };
+    const initialState = {
+      feedbackMsgText: 'some error message here',
+      feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
+    };
+
+    // When
+    const newState = GlobalInlineMessageBarReducer(initialState, action);
+
+    // Then
+    expect(newState).toEqual(initialState);
+  });
+});
index 62485ee..30d3fe9 100644 (file)
@@ -5,173 +5,363 @@ import {
   splitPaneResize,
   onNodeMenuChange,
   clearVIData,
-  setNotificationText
-} from 'app/tierSupport/TierSupportActions.js';
+  setNotificationText,
+  fetchSelectedNodeElement,
+  querySelectedNodeElement
+}
+from 'app/tierSupport/TierSupportActions';
+import {tierSupportActionTypes} from 'app/tierSupport/TierSupportConstants';
+import {MESSAGE_LEVEL_WARNING} from 'utils/GlobalConstants';
+import {globalInlineMessageBarActionTypes} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants';
 import {
-  tierSupportActionTypes
-} from 'app/tierSupport/TierSupportConstants.js';
-import {
-  MESSAGE_LEVEL_WARNING
-} from 'utils/GlobalConstants.js';
-import {
-  globalInlineMessageBarActionTypes
-} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants.js';
+  NO_RESULTS_FOUND,
+  ERROR_RETRIEVING_DATA
+} from 'app/networking/NetworkConstants';
+import networkCall from 'app/networking/NetworkCalls';
+
+const mockStore = configureStore([thunk]);
 
 describe('TierSupportActionTests', () => {
-  it('onNodeDetailsChange', () => {
-    const newDetails = {
-      id: '7352312c7bfa814c3071a803d98c5b670952765974876e55ef954e0f8a930b1c',
-      itemType: 'complex',
-      nodeMeta: {
-        nodeLabel1: 'Artic',
-        nodeValidated: false,
-        nodeLocation: 'bottom'
-      },
-      rootNode: false,
-      index: 2,
-    };
-    const middlewares = [thunk];
-    const mockStore = configureStore(middlewares);
-    const store = mockStore({ tierSupportReducer: {} });
-    store.dispatch(onNodeDetailsChange(newDetails));
-    const actions = store.getActions();
-    expect(actions).toEqual([{
-      type: tierSupportActionTypes.TS_GRAPH_NODE_SELECTED,
-      data: newDetails
-    }]);
+  let store;
+
+  beforeEach(() => {
+    store = mockStore({ tierSupportReducer: {} });
   });
 
-  it('splitPaneResize', () => {
-    const initialLoad = {
-      test: 'message'
-    };
-    const middlewares = [thunk];
-    const mockStore = configureStore(middlewares);
-    const store = mockStore({ tierSupportReducer: {} });
-    store.dispatch(splitPaneResize(initialLoad));
-    const actions = store.getActions();
-    expect(actions).toEqual([{
-      type: tierSupportActionTypes.SPLIT_PANE_RESIZE,
-      data: initialLoad
-    }]);
+  describe('onNodeDetailsChange', () => {
+    it('emits TS_GRAPH_NODE_SELECTED with payload', () => {
+      // Given
+      const newDetails = {
+        testDetails: 'Test Details',
+      };
+      const expectedActions = [{
+        type: tierSupportActionTypes.TS_GRAPH_NODE_SELECTED,
+        data: newDetails
+      }];
+
+      // When
+      store.dispatch(onNodeDetailsChange(newDetails));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
   });
 
-  it('onNodeMenuChange', () => {
-    const selectedMenu = {
-      test: 'menuData'
-    };
-    const middlewares = [thunk];
-    const mockStore = configureStore(middlewares);
-    const store = mockStore({ tierSupportReducer: {} });
-    store.dispatch(onNodeMenuChange(selectedMenu));
-    const actions = store.getActions();
-    expect(actions).toEqual([{
-      type: tierSupportActionTypes.TS_GRAPH_NODE_MENU_SELECTED,
-      data: selectedMenu
-    }]);
+  describe('splitPaneResize', () => {
+    it('emits SPLIT_PANE_RESIZE action with payload', () => {
+      // Given
+      const initialLoad = {
+        test: 'message'
+      };
+      const expectedActions = [{
+        type: tierSupportActionTypes.SPLIT_PANE_RESIZE,
+        data: initialLoad
+      }];
+
+      // When
+      store.dispatch(splitPaneResize(initialLoad));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
   });
 
-  it('clearVIData', () => {
-    const middlewares = [thunk];
-    const mockStore = configureStore(middlewares);
-    const store = mockStore({ tierSupportReducer: {} });
-    store.dispatch(clearVIData());
-    const actions = store.getActions();
-    expect(actions).toEqual([{
-      type: tierSupportActionTypes.TIER_SUPPORT_CLEAR_DATA
-    }]);
+  describe('onNodeMenuChange', () => {
+    it('emits TS_GRAPH_NODE_MENU_SELECTED action with payload', () => {
+      // Given
+      const selectedMenu = {
+        test: 'menuData'
+      };
+      const expectedActions = [{
+        type: tierSupportActionTypes.TS_GRAPH_NODE_MENU_SELECTED,
+        data: selectedMenu
+      }];
+
+      // When
+      store.dispatch(onNodeMenuChange(selectedMenu));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
   });
-  //
-  // it('fetchSelectedNodeElement - no results', () => {
-  //   const middlewares = [thunk];
-  //   const mockStore = configureStore(middlewares);
-  //   const store = mockStore({ tierSupportReducer: {} });
-  //   const nodes = [
-  //     {
-  //       id: '7352312c7bfa814c3071a803d98c5b670952765974876e55ef954e0f8a930b1c',
-  //       itemType: 'complex',
-  //       nodeMeta: {
-  //         className: 'selectedSearchedNodeClass',
-  //         nodeLabel1: 'Artic',
-  //         nodeValidated: false,
-  //         nodeLocation: 'bottom'
-  //       },
-  //       rootNode: false,
-  //       index: 2
-  //     },
-  //     {
-  //       id: '3899453d98c5b670952765974876e55ef954e0f8a930b1c',
-  //       itemType: 'generic-vnf',
-  //       nodeMeta: {
-  //         className: 'someOtherClassName',
-  //         nodeLabel1: 'Artic',
-  //         nodeValidated: false,
-  //         nodeLocation: 'bottom'
-  //       },
-  //       rootNode: false,
-  //       index: 1
-  //     }
-  //   ];
-  //   const expectedActions = [
-  //     {
-  //       type: tierSupportActionTypes.TS_NODE_SEARCH_RESULTS,
-  //       data: {
-  //         nodes: nodes
-  //       }
-  //     },
-  //     {
-  //       type: tierSupportActionTypes.TS_GRAPH_NODE_SELECTED,
-  //       data: nodes[0]
-  //     }
-  //   ];
-  //
-  //   console.log(nodes);
-  //
-  //   let fetchRequestCallback = () => {
-  //     const results = {
-  //       nodes: nodes
-  //     };
-  //     let init = { status: 200 };
-  //     let myBlob = new Blob();
-  //     let response = new Response();
-  //     return new Promise((resolve, reject) => {
-  //       resolve(response);
-  //     });
-  //   };
-  //   return store.dispatch(fetchSelectedNodeElement(fetchRequestCallback))
-  //     .then( () => {
-  //       const actions = store.getActions();
-  //       expect(actions).toEqual(expectedActions);
-  //     });
-  // });
-
-  it('setNotificationText', () => {
-    const middlewares = [thunk];
-    const mockStore = configureStore(middlewares);
-    const store = mockStore({ tierSupportReducer: {} });
-    const msgText = 'some test text';
-    const msgSeverity = MESSAGE_LEVEL_WARNING;
-    store.dispatch(setNotificationText(msgText, msgSeverity));
-    const actions = store.getActions();
-    expect(actions).toEqual([{
-      type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
-      data: {
-        msgText: msgText,
-        msgSeverity: msgSeverity
-      }
-    }]);
+
+  describe('clearVIData', () => {
+    it('emits TIER_SUPPORT_CLEAR_DATA action', () => {
+      // Given
+      const expectedActions = [{
+        type: tierSupportActionTypes.TIER_SUPPORT_CLEAR_DATA
+      }];
+
+      // When
+      store.dispatch(clearVIData());
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
   });
 
-  it('Clear notification text with setNotificationText', () => {
-    const middlewares = [thunk];
-    const mockStore = configureStore(middlewares);
-    const store = mockStore({ tierSupportReducer: {} });
-    const msgText = '';
-    const msgSeverity = MESSAGE_LEVEL_WARNING;
-    store.dispatch(setNotificationText(msgText, msgSeverity));
-    const actions = store.getActions();
-    expect(actions).toEqual([{
-      type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
-    }]);
+  describe('fetchSelectedNodeElement', () => {
+    it('emits actions with proper error message when 204 code returned', async () => {
+      // Given
+      const promise = () => getPromiseWithStatusCode(204);
+      const expectedActions = [
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_DISABLE_BUSY_FEEDBACK,
+        },
+        {
+          type: tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS,
+          data: {errorMsg: NO_RESULTS_FOUND}
+        }
+      ];
+
+      // When
+      await store.dispatch(fetchSelectedNodeElement(promise));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+
+    it('emits actions with proper error message when 3XX code returned', async () => {
+      // Given
+      const promise = () => getPromiseWithStatusCode(301);
+      const expectedActions = [
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_DISABLE_BUSY_FEEDBACK,
+        },
+        {
+          type: tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS,
+          data: {errorMsg: NO_RESULTS_FOUND}
+        }
+      ];
+
+      // When
+      await store.dispatch(fetchSelectedNodeElement(promise));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+
+    it('emits actions with proper error message when 5XX code returned', async () => {
+      // Given
+      const promise = () => getPromiseWithStatusCode(501);
+      const expectedActions = [
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_DISABLE_BUSY_FEEDBACK,
+        },
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_NETWORK_ERROR,
+          data: {value: ERROR_RETRIEVING_DATA, errorMsg: ERROR_RETRIEVING_DATA}
+        }
+      ];
+
+      // When
+      await store.dispatch(fetchSelectedNodeElement(promise));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+
+    it('emits actions with payload when 200 code returned and nodes not empty', async () => {
+      // Given
+      const {nodes, node1} = prepareTestNodes();
+      const promise = () => getNodesPromise(nodes);
+      const expectedActions = [
+        {
+          type: tierSupportActionTypes.TS_NODE_SEARCH_RESULTS,
+          data: {"nodes": nodes}
+        },
+        {
+          type: tierSupportActionTypes.TS_GRAPH_NODE_SELECTED,
+          data: node1
+        },
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_DISABLE_BUSY_FEEDBACK
+        }
+      ];
+
+      // When
+      await store.dispatch(fetchSelectedNodeElement(promise));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+
+    it('emits actions with payload when 200 code returned and nodes empty', async () => {
+      // Given
+      const promise = () => getNodesPromise([]);
+      const expectedActions = [
+        {
+          type: tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS,
+          data: {errorMsg: NO_RESULTS_FOUND}
+        },
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_DISABLE_BUSY_FEEDBACK
+        }
+      ];
+
+      // When
+      await store.dispatch(fetchSelectedNodeElement(promise));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
   });
-})
+
+  describe('querySelectedNodeElement', () => {
+    const searchHash = "testHash";
+
+    it('emits actions when fetchRequest defined ', async () => {
+      // Given
+      const promise = () => getNodesPromise([]);
+      const expectedAction = [
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_ACTIVATE_BUSY_FEEDBACK,
+        },
+        {
+          type: tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS,
+          data: {errorMsg: NO_RESULTS_FOUND}
+        },
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_DISABLE_BUSY_FEEDBACK
+        }
+      ];
+
+      // When
+      await store.dispatch(querySelectedNodeElement(searchHash, promise));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedAction);
+    });
+
+    it('builds request and emits actions when fetchRequest undefined ', async () => {
+      // Given
+      const stringifySpy = jest.spyOn(JSON, 'stringify');
+      const promise = getNodesPromise([]);
+      networkCall.fetchRequestObj = jest.fn(() => promise);
+      const expectedStringifyInput = {
+        hashId: searchHash
+      };
+      const expectedFetchRequestBody = "{\"hashId\":\"testHash\"}";
+      const expectedAction = [
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_ACTIVATE_BUSY_FEEDBACK,
+        },
+        {
+          type: tierSupportActionTypes.TS_NODE_SEARCH_NO_RESULTS,
+          data: {errorMsg: NO_RESULTS_FOUND}
+        },
+        {
+          type: tierSupportActionTypes.TIER_SUPPORT_DISABLE_BUSY_FEEDBACK
+        }
+      ];
+
+      // When
+      await store.dispatch(querySelectedNodeElement(searchHash, undefined));
+
+      // Then
+      expect(stringifySpy).toHaveBeenCalledWith(expectedStringifyInput);
+      expect(networkCall.fetchRequestObj).toHaveBeenCalledWith(
+          expect.anything(),
+          expect.anything(),
+          expect.anything(),
+          expectedFetchRequestBody
+      );
+      expect(store.getActions()).toEqual(expectedAction);
+    });
+  });
+
+  describe('setNotificationText', () => {
+  const msgSeverity = MESSAGE_LEVEL_WARNING;
+
+    it('emits SET_GLOBAL_MESSAGE action with payload when msgText is not blank ', () => {
+      // Given
+      const msgText = 'some test text';
+      const expectedActions = [{
+        type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
+        data: {
+          msgText: msgText,
+          msgSeverity: msgSeverity
+        }
+      }];
+
+      // When
+      store.dispatch(setNotificationText(msgText, msgSeverity));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+
+    it('emits CLEAR_GLOBAL_MESSAGE when msgText is blank ', () => {
+      // Given
+      const msgText = '';
+      const expectedActions = [{
+        type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
+      }];
+
+      // When
+      store.dispatch(setNotificationText(msgText, msgSeverity));
+
+      // Then
+      expect(store.getActions()).toEqual(expectedActions);
+    });
+  });
+
+  function getPromiseWithStatusCode(statusCode) {
+    return new Promise(function(resolve) {
+      resolve({status: statusCode});
+    });
+  }
+
+  function getNodesPromise(nodes) {
+    return new Promise(function (resolve) {
+      resolve({
+        status: 200,
+        json: () => {
+          return {
+            nodes: nodes
+          };
+        }
+      });
+    });
+  }
+
+  function prepareTestNodes() {
+    const node1 = prepareSelectedClassTestNode();
+    const node2 = prepareOtherClassTestNode();
+    return {
+      nodes: [node1, node2],
+      node1,
+      node2
+    }
+  }
+
+  function prepareOtherClassTestNode() {
+    return  {
+      id: '3899453d98c5b670952765974876e55ef954e0f8a930b1c',
+      itemType: 'generic-vnf',
+      nodeMeta: {
+        className: 'someOtherClassName',
+        nodeLabel1: 'Artic',
+        nodeValidated: false,
+        nodeLocation: 'bottom'
+      },
+      rootNode: false,
+      index: 1
+    };
+  }
+
+  function prepareSelectedClassTestNode() {
+    return {
+      id: '7352312c7bfa814c3071a803d98c5b670952765974876e55ef954e0f8a930b1c',
+      itemType: 'complex',
+      nodeMeta: {
+        className: 'selectedSearchedNodeClass',
+        nodeLabel1: 'Artic',
+        nodeValidated: false,
+        nodeLocation: 'bottom'
+      },
+      rootNode: false,
+      index: 2
+    };
+  }
+});
index 66827fd..4814eb2 100644 (file)
@@ -4,8 +4,8 @@
 # because they are used in Jenkins, whose plug-in doesn't support
 
 major_version=1
-minor_version=4
-patch_version=0
+minor_version=5
+patch_version=1
 
 base_version=${major_version}.${minor_version}.${patch_version}