1 import configureStore from 'redux-mock-store';
2 import thunk from 'redux-thunk'
6 extensibleViewMessageCallback,
7 clearExtensibleViewData,
9 } from 'app/MainScreenWrapperActionHelper';
11 getSetGlobalMessageEvent,
12 getClearGlobalMessageEvent
13 } from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions';
15 globalInlineMessageBarActionTypes
16 } from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants';
17 import {aaiActionTypes} from 'app/MainScreenWrapperConstants';
19 const mockStore = configureStore([thunk]);
21 describe('MainScreenWrapperActionHelper', () => {
25 store = mockStore({ tierSupportReducer: {} });
28 describe('windowResize', () => {
29 it('emits action', () => {
31 const expectedActions = [{
32 type: aaiActionTypes.AAI_WINDOW_RESIZE
36 store.dispatch(windowResize());
39 expect(store.getActions()).toEqual(expectedActions);
43 describe('showMainMenu', () => {
44 it('emits action with payload', () => {
46 const input = "testInput";
47 const expectedActions = [{
48 type: aaiActionTypes.AAI_SHOW_MENU,
55 store.dispatch(showMainMenu(input));
58 expect(store.getActions()).toEqual(expectedActions);
62 describe('extensibleViewMessageCallback', () => {
63 const msgSeverity = "msgSeverity";
65 it('emits action with payload when msgText is not blank', () => {
67 const msgText = "msgText";
68 const expectedActions = [{
69 type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
72 msgSeverity: msgSeverity
77 store.dispatch(extensibleViewMessageCallback(msgText, msgSeverity));
80 expect(store.getActions()).toEqual(expectedActions);
83 it('emits action when msgText is blank', () => {
86 const expectedActions = [{
87 type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
92 store.dispatch(extensibleViewMessageCallback(msgText, msgSeverity));
95 expect(store.getActions()).toEqual(expectedActions);
99 describe('clearExtensibleViewData', () => {
100 it('emits action with payload', () => {
102 const expectedActions = [{
103 type: aaiActionTypes.EXTENSIBLE_VIEW_NETWORK_CALLBACK_CLEAR_DATA,
108 store.dispatch(clearExtensibleViewData());
111 expect(store.getActions()).toEqual(expectedActions);
115 describe('setSecondaryTitle', () => {
116 it('emits action with payload', () => {
118 const title = "testTitle";
119 const expectedActions = [{
120 type: aaiActionTypes.SET_SECONDARY_TITLE,
125 store.dispatch(setSecondaryTitle(title));
128 expect(store.getActions()).toEqual(expectedActions);