increasing test coverage to 20 percent
[aai/sparky-fe.git] / test / globalInlineMessageBar / GlobalInlineMessageBarAction.test.js
1 import configureStore from 'redux-mock-store';
2 import thunk from 'redux-thunk';
3
4 import {
5   getSetGlobalMessageEvent,
6   getClearGlobalMessageEvent
7 } from 'app/globalInlineMessageBar/GlobalInlineMessageBarActions.js';
8 import {
9   globalInlineMessageBarActionTypes
10 } from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants.js';
11 import {
12   MESSAGE_LEVEL_WARNING
13 } from 'utils/GlobalConstants.js'
14
15 describe('GlobalInlineMessageBarActionTests', () => {
16   it('getSetGlobalMessageEvent', () => {
17     const middlewares = [thunk];
18     const mockStore = configureStore(middlewares);
19     const store = mockStore({});
20     const msgText = 'some test msg';
21     store.dispatch(getSetGlobalMessageEvent(msgText, MESSAGE_LEVEL_WARNING));
22     const actions = store.getActions();
23     expect(actions).toEqual([{
24       type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
25       data: {
26         msgText: msgText,
27         msgSeverity: MESSAGE_LEVEL_WARNING
28       }
29     }]);
30   });
31
32   it('getClearGlobalMessageEvent', () => {
33     const middlewares = [thunk];
34     const mockStore = configureStore(middlewares);
35     const store = mockStore({});
36     store.dispatch(getClearGlobalMessageEvent());
37     const actions = store.getActions();
38     expect(actions).toEqual([{
39       type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
40     }]);
41   });
42 })