Add tests to Inventory module
[aai/sparky-fe.git] / test / globalInlineMessageBar / GlobalInlineMessageBarReducer.test.js
1 import GlobalInlineMessageBarReducer from 'app/globalInlineMessageBar/GlobalInlineMessageBarReducer.js';
2 import {
3   globalInlineMessageBarActionTypes
4 } from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants.js';
5 import {
6   MESSAGE_LEVEL_WARNING
7 } from 'utils/GlobalConstants.js'
8
9 describe('GlobalInlineMessageBarReducerTests', () => {
10   it('Action Type: SET_GLOBAL_MESSAGE', () => {
11     const action = {
12       type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
13       data: {
14         msgText: 'some error message here',
15         msgSeverity: MESSAGE_LEVEL_WARNING
16       }
17     };
18     let state = {};
19     state = GlobalInlineMessageBarReducer(state, action);
20     expect(state).toEqual({
21       feedbackMsgText: action.data.msgText,
22       feedbackMsgSeverity: action.data.msgSeverity
23     });
24   });
25
26   it('Action Type: CLEAR_GLOBAL_MESSAGE', () => {
27     const action = {
28       type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
29     };
30     let state = {
31       feedbackMsgText: 'some error message here',
32       feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
33     };
34     state = GlobalInlineMessageBarReducer(state, action);
35     expect(state).toEqual({
36       feedbackMsgText: '',
37       feedbackMsgSeverity: ''
38     });
39   });
40 })

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use