summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
6a47c24)
Add test for default route and minor test refactor
Change-Id: I91f0167318ab94eb4c5033dfe594e2bc4e65114f
Issue-ID: AAI-1618
Signed-off-by: awudzins <adam.wudzinski@nokia.com>
-import GlobalInlineMessageBarReducer from 'app/globalInlineMessageBar/GlobalInlineMessageBarReducer.js';
+import GlobalInlineMessageBarReducer from 'app/globalInlineMessageBar/GlobalInlineMessageBarReducer';
import {
globalInlineMessageBarActionTypes
import {
globalInlineMessageBarActionTypes
-} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants.js';
+} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants';
import {
MESSAGE_LEVEL_WARNING
import {
MESSAGE_LEVEL_WARNING
-} from 'utils/GlobalConstants.js'
+} from 'utils/GlobalConstants'
describe('GlobalInlineMessageBarReducerTests', () => {
it('Action Type: SET_GLOBAL_MESSAGE', () => {
describe('GlobalInlineMessageBarReducerTests', () => {
it('Action Type: SET_GLOBAL_MESSAGE', () => {
const action = {
type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
data: {
const action = {
type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE,
data: {
state = GlobalInlineMessageBarReducer(state, action);
state = GlobalInlineMessageBarReducer(state, action);
expect(state).toEqual({
feedbackMsgText: action.data.msgText,
feedbackMsgSeverity: action.data.msgSeverity
expect(state).toEqual({
feedbackMsgText: action.data.msgText,
feedbackMsgSeverity: action.data.msgSeverity
});
it('Action Type: CLEAR_GLOBAL_MESSAGE', () => {
});
it('Action Type: CLEAR_GLOBAL_MESSAGE', () => {
const action = {
type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
};
const action = {
type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE
};
feedbackMsgText: 'some error message here',
feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
};
feedbackMsgText: 'some error message here',
feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
};
state = GlobalInlineMessageBarReducer(state, action);
state = GlobalInlineMessageBarReducer(state, action);
expect(state).toEqual({
feedbackMsgText: '',
feedbackMsgSeverity: ''
});
});
expect(state).toEqual({
feedbackMsgText: '',
feedbackMsgSeverity: ''
});
});
+
+ it('Action Type: unknown', () => {
+ // Given
+ const action = {
+ type: "TestUnknownType"
+ };
+ const initialState = {
+ feedbackMsgText: 'some error message here',
+ feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
+ };
+
+ // When
+ const newState = GlobalInlineMessageBarReducer(initialState, action);
+
+ // Then
+ expect(newState).toEqual(initialState);
+ });
+});