コード例 #1
0
    it('dispatches SIGNUP_USER and SIGNUP_ERROR_USER when Sign Up returns status of NOT 200', (done) => {
      const expectedActions = [
      {
        type: types.SIGNUP_USER
      },
      {
        type: types.SIGNUP_ERROR_USER,
      }];

      sandbox.stub(axios, 'post').returns(Promise.reject());

      const store = mockStore(initialState);
      store.dispatch(actions.logOut(data))
        .then(() => {
          expect(store.getActions()).toEqual(expectedActions);
        }).then(done).catch(done);
    });
コード例 #2
0
    it('dispatches SIGNUP_USER and SIGNUP_SUCCESS_USER when Sign Up returns status of 200 and routes user to /', (done) => {
      const expectedActions = [
      {
        type: types.LOGOUT_USER
      },
      {
        type: types.LOGOUT_SUCCESS_USER
      }];

      sandbox.stub(axios, 'post').returns(Promise.resolve({status: 200}));

      const store = mockStore(initialState);
      store.dispatch(actions.logOut(data))
        .then(() => {
          expect(store.getActions()).toEqual(expectedActions);
        }).then(done).catch(done);
    });