diff options
author | James Forsyth <jf2512@att.com> | 2019-04-11 12:59:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-11 12:59:37 +0000 |
commit | e88f4b89dee85737f3e136ca589e5fb26decc32a (patch) | |
tree | a84c7d4e51ac2959308afa570556bc9f90973fb9 /test/app | |
parent | 8d1e8bb11b0cfe24e48cdd2e96dde74a8a70f77c (diff) | |
parent | 5d6f9413bc956f905d7b35fe59d626e285e973cf (diff) |
Merge "GlobalInlineMessageBarReducer test"1.4.0
Diffstat (limited to 'test/app')
-rw-r--r-- | test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js b/test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js index 62389b4..bbcb7c1 100644 --- a/test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js +++ b/test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js @@ -1,13 +1,14 @@ -import GlobalInlineMessageBarReducer from 'app/globalInlineMessageBar/GlobalInlineMessageBarReducer.js'; +import GlobalInlineMessageBarReducer from 'app/globalInlineMessageBar/GlobalInlineMessageBarReducer'; import { globalInlineMessageBarActionTypes -} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants.js'; +} from 'app/globalInlineMessageBar/GlobalInlineMessageBarConstants'; import { MESSAGE_LEVEL_WARNING -} from 'utils/GlobalConstants.js' +} from 'utils/GlobalConstants' describe('GlobalInlineMessageBarReducerTests', () => { it('Action Type: SET_GLOBAL_MESSAGE', () => { + // Given const action = { type: globalInlineMessageBarActionTypes.SET_GLOBAL_MESSAGE, data: { @@ -16,7 +17,11 @@ describe('GlobalInlineMessageBarReducerTests', () => { } }; let state = {}; + + // When state = GlobalInlineMessageBarReducer(state, action); + + // Then expect(state).toEqual({ feedbackMsgText: action.data.msgText, feedbackMsgSeverity: action.data.msgSeverity @@ -24,6 +29,7 @@ describe('GlobalInlineMessageBarReducerTests', () => { }); it('Action Type: CLEAR_GLOBAL_MESSAGE', () => { + // Given const action = { type: globalInlineMessageBarActionTypes.CLEAR_GLOBAL_MESSAGE }; @@ -31,10 +37,31 @@ describe('GlobalInlineMessageBarReducerTests', () => { feedbackMsgText: 'some error message here', feedbackMsgSeverity: MESSAGE_LEVEL_WARNING }; + + // When state = GlobalInlineMessageBarReducer(state, action); + + // Then 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); + }); +}); |