1 import NotificationReducer from 'generic-components/notifications/NotificationReducer';
2 import NotificationConstants from "generic-components/notifications/NotificationConstants";
5 describe('NotificationReducer', () => {
8 title: 'some default title',
9 msg: 'some default message',
13 it('Should return default state when action type is not supported', () => {
15 const unsupportedAction = {
20 const actualState = NotificationReducer(defaultState, unsupportedAction);
23 expect(actualState).toEqual(defaultState);
26 it('Should return state with type default when action type is info', () => {
28 const expectedState = {
36 type: NotificationConstants.NOTIFY_INFO,
45 const actualState = NotificationReducer(defaultState, infoAction);
48 expect(actualState).toEqual(expectedState);
52 it('Should return status with type success when action type is success', () => {
54 const expectedState = {
62 type: NotificationConstants.NOTIFY_SUCCESS,
71 const actualState = NotificationReducer(defaultState, infoAction);
74 expect(actualState).toEqual(expectedState);
77 it('Should return status with type success when action type is success', () => {
79 const expectedState = {
87 type: NotificationConstants.NOTIFY_SUCCESS,
96 const actualState = NotificationReducer(defaultState, infoAction);
99 expect(actualState).toEqual(expectedState);
102 it('Should return status with type error when action type is error', () => {
104 const expectedState = {
112 type: NotificationConstants.NOTIFY_ERROR,
121 const actualState = NotificationReducer(defaultState, infoAction);
124 expect(actualState).toEqual(expectedState);
127 it('Should return status with type error when action type is error', () => {
129 const expectedState = {
137 type: NotificationConstants.NOTIFY_ERROR,
146 const actualState = NotificationReducer(defaultState, infoAction);
149 expect(actualState).toEqual(expectedState);
152 it('Should return status with type warning when action type is warning', () => {
154 const expectedState = {
162 type: NotificationConstants.NOTIFY_WARNING,
171 const actualState = NotificationReducer(defaultState, infoAction);
174 expect(actualState).toEqual(expectedState);
177 it('Should return null when action type is close', () => {
179 const expectedState = null;
182 type: NotificationConstants.NOTIFY_CLOSE,
191 const actualState = NotificationReducer(defaultState, infoAction);
194 expect(actualState).toEqual(expectedState);