Exemplo n.º 1
0
export function updateUserInfo(nextState, replace, callback) {
  const storeContent = store.getState();

  if (!storeContent.users.show.isEmpty) {
    store.dispatch(getUser(nextState.params.user));
  }

  callback();
}
Exemplo n.º 2
0
      it('fires USER_INFO_FAILED action', () => {
        const errorParams = { errors: 'User not found' };

        nock('http://localhost:3000')
            .get('/api/v1/users/1')
            .reply(404, errorParams);

        const expectedActions = [
          { type: 'START_MAIN_LOADER' },
          { type: 'STOP_MAIN_LOADER' },
          { type: 'USER_INFO_FAILED', errors: 'User not found' }
        ];

        const store = mockStore({});

        return store.dispatch(getUser(1))
          .then(() => {
            expect(store.getActions()).toEqual(expectedActions);
          });
      });
Exemplo n.º 3
0
      it('fires USER_INFO action', () => {
        const userParams = { user: { nick: 'example' } };

        nock('http://localhost:3000')
            .get('/api/v1/users/1')
            .reply(200, userParams);

        const expectedActions = [
          { type: 'START_MAIN_LOADER' },
          { type: 'STOP_MAIN_LOADER' },
          { type: 'USER_INFO', user: { nick: 'example' } }
        ];

        const store = mockStore({});

        return store.dispatch(getUser(1))
          .then(() => {
            expect(store.getActions()).toEqual(expectedActions);
          });
      });