1 import configureStore from 'redux-mock-store';
2 import thunk from 'redux-thunk'
9 } from 'app/tierSupport/TierSupportActions.js';
11 tierSupportActionTypes
12 } from 'app/tierSupport/TierSupportConstants.js';
15 } from 'utils/GlobalConstants.js';
17 globalInlineMessageBarActionTypes
18 } from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants.js';
20 describe('TierSupportActionTests', () => {
21 it('onNodeDetailsChange', () => {
23 id: '7352312c7bfa814c3071a803d98c5b670952765974876e55ef954e0f8a930b1c',
28 nodeLocation: 'bottom'
33 const middlewares = [thunk];
34 const mockStore = configureStore(middlewares);
35 const store = mockStore({ tierSupportReducer: {} });
36 store.dispatch(onNodeDetailsChange(newDetails));
37 const actions = store.getActions();
38 expect(actions).toEqual([{
39 type: tierSupportActionTypes.TS_GRAPH_NODE_SELECTED,
44 it('splitPaneResize', () => {
48 const middlewares = [thunk];
49 const mockStore = configureStore(middlewares);
50 const store = mockStore({ tierSupportReducer: {} });
51 store.dispatch(splitPaneResize(initialLoad));
52 const actions = store.getActions();
53 expect(actions).toEqual([{
54 type: tierSupportActionTypes.SPLIT_PANE_RESIZE,
59 it('onNodeMenuChange', () => {
60 const selectedMenu = {
63 const middlewares = [thunk];
64 const mockStore = configureStore(middlewares);
65 const store = mockStore({ tierSupportReducer: {} });
66 store.dispatch(onNodeMenuChange(selectedMenu));
67 const actions = store.getActions();
68 expect(actions).toEqual([{
69 type: tierSupportActionTypes.TS_GRAPH_NODE_MENU_SELECTED,
74 it('clearVIData', () => {
75 const middlewares = [thunk];
76 const mockStore = configureStore(middlewares);
77 const store = mockStore({ tierSupportReducer: {} });
78 store.dispatch(clearVIData());
79 const actions = store.getActions();
80 expect(actions).toEqual([{
81 type: tierSupportActionTypes.TIER_SUPPORT_CLEAR_DATA
85 // it('fetchSelectedNodeElement - no results', () => {
86 // const middlewares = [thunk];
87 // const mockStore = configureStore(middlewares);
88 // const store = mockStore({ tierSupportReducer: {} });
91 // id: '7352312c7bfa814c3071a803d98c5b670952765974876e55ef954e0f8a930b1c',
92 // itemType: 'complex',
94 // className: 'selectedSearchedNodeClass',
95 // nodeLabel1: 'Artic',
96 // nodeValidated: false,
97 // nodeLocation: 'bottom'
103 // id: '3899453d98c5b670952765974876e55ef954e0f8a930b1c',
104 // itemType: 'generic-vnf',
106 // className: 'someOtherClassName',
107 // nodeLabel1: 'Artic',
108 // nodeValidated: false,
109 // nodeLocation: 'bottom'
115 // const expectedActions = [
117 // type: tierSupportActionTypes.TS_NODE_SEARCH_RESULTS,
123 // type: tierSupportActionTypes.TS_GRAPH_NODE_SELECTED,
128 // console.log(nodes);
130 // let fetchRequestCallback = () => {
134 // let init = { status: 200 };
135 // let myBlob = new Blob();
136 // let response = new Response();
137 // return new Promise((resolve, reject) => {
138 // resolve(response);
141 // return store.dispatch(fetchSelectedNodeElement(fetchRequestCallback))
143 // const actions = store.getActions();
144 // expect(actions).toEqual(expectedActions);
148 it('setNotificationText', () => {
149 const middlewares = [thunk];
150 const mockStore = configureStore(middlewares);
151 const store = mockStore({ tierSupportReducer: {} });
152 const msgText = 'some test text';
153 const msgSeverity = MESSAGE_LEVEL_WARNING;
154 store.dispatch(setNotificationText(msgText, msgSeverity));
155 const actions = store.getActions();
156 expect(actions).toEqual([{
157 type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
160 msgSeverity: msgSeverity
165 it('Clear notification text with setNotificationText', () => {
166 const middlewares = [thunk];
167 const mockStore = configureStore(middlewares);
168 const store = mockStore({ tierSupportReducer: {} });
170 const msgSeverity = MESSAGE_LEVEL_WARNING;
171 store.dispatch(setNotificationText(msgText, msgSeverity));
172 const actions = store.getActions();
173 expect(actions).toEqual([{
174 type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE