summaryrefslogtreecommitdiffstats
path: root/test/app/tierSupport/TierSupportActions.test.js
diff options
context:
space:
mode:
authorAdam Wudzinski <adam.wudzinski@nokia.com>2019-03-26 16:47:06 +0100
committerawudzins <adam.wudzinski@nokia.com>2019-03-26 16:47:06 +0100
commitb0f2f345cc2d1cc3812ad8a06fc1898daf5842d0 (patch)
treee6022e92e026a02912548e313ff2a02b5c27ddec /test/app/tierSupport/TierSupportActions.test.js
parentb2c7546f9027099161aeaf5791f1d0f3a52b92d2 (diff)
Remove unused code
Remove unsed code from generic-components and change tests directory structure to reflect src structure Change-Id: Iada2efb0f7cfb05557eb7cd709b8a0ed75976b03 Issue-ID: AAI-1618 Signed-off-by: awudzins <adam.wudzinski@nokia.com>
Diffstat (limited to 'test/app/tierSupport/TierSupportActions.test.js')
-rw-r--r--test/app/tierSupport/TierSupportActions.test.js177
1 files changed, 177 insertions, 0 deletions
diff --git a/test/app/tierSupport/TierSupportActions.test.js b/test/app/tierSupport/TierSupportActions.test.js
new file mode 100644
index 0000000..62485ee
--- /dev/null
+++ b/test/app/tierSupport/TierSupportActions.test.js
@@ -0,0 +1,177 @@
+import configureStore from 'redux-mock-store';
+import thunk from 'redux-thunk'
+import {
+ onNodeDetailsChange,
+ splitPaneResize,
+ onNodeMenuChange,
+ clearVIData,
+ setNotificationText
+} from 'app/tierSupport/TierSupportActions.js';
+import {
+ tierSupportActionTypes
+} from 'app/tierSupport/TierSupportConstants.js';
+import {
+ MESSAGE_LEVEL_WARNING
+} from 'utils/GlobalConstants.js';
+import {
+ globalInlineMessageBarActionTypes
+} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants.js';
+
+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
+ }]);
+ });
+
+ 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
+ }]);
+ });
+
+ 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
+ }]);
+ });
+
+ 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
+ }]);
+ });
+ //
+ // 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
+ }
+ }]);
+ });
+
+ 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
+ }]);
+ });
+})