Skip to content

Conversation

@leonardokl
Copy link

@leonardokl leonardokl commented Mar 21, 2017

Fixes #204

@leonardokl leonardokl changed the title Add handleAction example with a reducer function to README #204 Add handleAction example with a reducer function to README Mar 21, 2017
@yangmillstheory yangmillstheory self-assigned this Mar 21, 2017
@yangmillstheory
Copy link
Contributor

What do you think about pulling an example from the tests?

https://github.com/acdlite/redux-actions/blob/master/src/__tests__/handleAction-test.js

I believe most of the examples in the README are in this format.

Thanks for your time!

@leonardokl
Copy link
Author

Ok! I updated the example with one that was in the test.

@yangmillstheory
Copy link
Contributor

Can you include the expectations in the test?

@leonardokl
Copy link
Author

I didn't get it, what kind of expectations you mean?

@yangmillstheory
Copy link
Contributor

yangmillstheory commented Mar 21, 2017 via email

@leonardokl
Copy link
Author

There are similar expectations in the test, like the one bellow.

it('accepts action function as action type', () => {
  const incrementAction = createAction(type);
  const reducer = handleAction(incrementAction, (state, action) => ({
    counter: state.counter + action.payload
  }), defaultState);

  expect(reducer(prevState, incrementAction(7)))
    .to.deep.equal({
      counter: 10
    });
});

@zaidchauhan
Copy link

@leonardokl Will you please make new commit to resolve conflict

@mslipper
Copy link
Contributor

I can just resolve them from here.

@mslipper
Copy link
Contributor

Hmm the README changed significantly since this PR was opened. I recommend closing this pr since the underlying issue that it fixes is also fixed in #222.

@mslipper mslipper closed this Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants