summaryrefslogtreecommitdiffstats
path: root/test/app/globalInlineMessageBar
diff options
context:
space:
mode:
authorAdam Wudzinski <adam.wudzinski@nokia.com>2019-04-10 16:43:31 +0200
committerawudzins <adam.wudzinski@nokia.com>2019-04-10 16:43:31 +0200
commit5d6f9413bc956f905d7b35fe59d626e285e973cf (patch)
tree5bf7e3500f535d1e1b218fc04fb0c092097aa64a /test/app/globalInlineMessageBar
parent6a47c2493c21c09df35df1f9f03474f8c2f8874a (diff)
GlobalInlineMessageBarReducer test
Add test for default route and minor test refactor Change-Id: I91f0167318ab94eb4c5033dfe594e2bc4e65114f Issue-ID: AAI-1618 Signed-off-by: awudzins <adam.wudzinski@nokia.com>
Diffstat (limited to 'test/app/globalInlineMessageBar')
-rw-r--r--test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js35
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);
+ });
+});