/ common / features / notifications / reducer.spec.ts
reducer.spec.ts
 1  import * as actions from './actions';
 2  import * as reducer from './reducer';
 3  
 4  describe('customTokens reducer', () => {
 5    const notification1 = actions.showNotification('success', 'msg');
 6  
 7    const notification2 = actions.showNotification('danger', 'msg');
 8  
 9    it('should handle SHOW_NOTIFICATION', () => {
10      const state = reducer.notificationsReducer(undefined, notification1);
11      expect(reducer.notificationsReducer(state, notification2)).toEqual([
12        notification1.payload,
13        notification2.payload
14      ]);
15    });
16  
17    it('should handle CLOSE_NOTIFICATION', () => {
18      const state1 = reducer.notificationsReducer(undefined, notification1);
19      const state2 = reducer.notificationsReducer(state1, notification2);
20  
21      expect(
22        reducer.notificationsReducer(state2, actions.closeNotification(notification2.payload))
23      ).toEqual([notification1.payload]);
24    });
25  });