it('should set state to successful update with an empty user', () => {
      const toTest = userManagement(undefined, { type: SUCCESS(ACTION_TYPES.DELETE_USER) });

      expect(toTest).toMatchObject({
        updating: false,
        updateSuccess: true
      });
      expect(isEmpty(toTest.user));
    });
    it('should update state according to a successful fetch role request', () => {
      const payload = { data: ['ROLE_ADMIN'] };
      const toTest = userManagement(undefined, { type: SUCCESS(ACTION_TYPES.FETCH_ROLES), payload });

      expect(toTest).toMatchObject({
        loading: false,
        authorities: payload.data
      });
    });
    it('should update state according to a successful fetch user request', () => {
      const payload = { data: 'some handsome user' };
      const toTest = userManagement(undefined, { type: SUCCESS(ACTION_TYPES.FETCH_USER), payload });

      expect(toTest).toMatchObject({
        loading: false,
        user: payload.data
      });
    });
 it('dispatches ACTION_TYPES.RESET actions', async () => {
   const expectedActions = [
     {
       type: ACTION_TYPES.RESET
     }
   ];
   await store.dispatch(reset());
   expect(store.getActions()).toEqual(expectedActions);
 });
    it('should update state according to a successful fetch users request', () => {
      const headers = { ['x-total-count']: 42 };
      const payload = { data: 'some handsome users', headers };
      const toTest = userManagement(undefined, { type: SUCCESS(ACTION_TYPES.FETCH_USERS), payload });

      expect(toTest).toMatchObject({
        loading: false,
        users: payload.data,
        totalItems: headers['x-total-count']
      });
    });
 it('dispatches FETCH_USER_PENDING and FETCH_USER_FULFILLED actions', async () => {
   const expectedActions = [
     {
       type: REQUEST(ACTION_TYPES.FETCH_USER)
     },
     {
       type: SUCCESS(ACTION_TYPES.FETCH_USER),
       payload: resolvedObject
     }
   ];
   await store.dispatch(getUser('admin')).then(() => expect(store.getActions()).toEqual(expectedActions));
 });
 it('dispatches FETCH_USERS_PENDING and FETCH_USERS_FULFILLED actions with pagination options', async () => {
   const expectedActions = [
     {
       type: REQUEST(ACTION_TYPES.FETCH_USERS)
     },
     {
       type: SUCCESS(ACTION_TYPES.FETCH_USERS),
       payload: resolvedObject
     }
   ];
   await store.dispatch(getUsers(1, 20, 'id,desc')).then(() => expect(store.getActions()).toEqual(expectedActions));
 });
 it('should reset the state', () => {
   const initialState = {
     loading: false,
     errorMessage: null,
     users: [],
     authorities: [] as any[],
     user: defaultValue,
     updating: false,
     updateSuccess: false,
     totalItems: 0
   };
   const payload = {
     ...initialState,
     loading: true
   };
   expect(
     userManagement(payload, {
       type: ACTION_TYPES.RESET
     })
   ).toEqual(initialState);
 });
 it('should not modify the current state', () => {
   testInitialState(userManagement(undefined, { type: REQUEST(ACTION_TYPES.FETCH_ROLES) }));
 });
 it('should return the initial state', () => {
   testInitialState(userManagement(undefined, {}));
 });