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