Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor console reducer to use handleActions, test with Jest #1687

Merged
merged 9 commits into from
May 18, 2019

Conversation

outoftime
Copy link
Contributor

@outoftime outoftime commented May 9, 2019

Introduce two patterns to the console reducers that we would like to eventually use for all reducers:

  • Reducers use handleActions() rather than a hand-rolled switch statement; these use the action creators themselves as keys to avoid hard-coding constant names
  • Reducer is tested with Jest; tests run a series of actions through the reducer and then make discrete assertions about final state

@outoftime outoftime requested a review from jwang1919 May 9, 2019 01:01
src/reducers/__tests__/console.test.jsx Show resolved Hide resolved
src/reducers/__tests__/console.test.jsx Show resolved Hide resolved
src/reducers/__tests__/console.test.jsx Show resolved Hide resolved
src/reducers/__tests__/console.test.jsx Show resolved Hide resolved
src/reducers/console.js Outdated Show resolved Hide resolved
outoftime added 9 commits May 18, 2019 11:41
Migrates the console reducer to use `handleActions` rather than
hand-rolled reducer logic built around a `switch` statement. Uses action
creators as keys (which is something `redux-actions` explicitly affords)
to reduce repetition of magic action type constant strings.
@outoftime outoftime merged commit eeffafe into popcodeorg:master May 18, 2019
@outoftime outoftime deleted the enum-actions branch May 18, 2019 15:58
@outoftime
Copy link
Contributor Author

Step toward #1690
Step toward #1443

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.

2 participants