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

#240 - Make reducers pure by passing date as an argument. #241

Merged
merged 1 commit into from
Aug 19, 2016

Conversation

samit4me
Copy link
Contributor

Reducer is now pure because the Date is passed as an argument.

This change makes testing the ActionCreators more difficult as the date needs to be mocked, so the date is being mocked using mockdate. I've tried to mock using babel-plugin-rewire but ran into issues regarding named exports which seem to be related to this issue.

@coveralls
Copy link

coveralls commented Aug 19, 2016

Coverage Status

Coverage increased (+0.04%) to 95.0% when pulling ecb3d2d on samit4me:240-pure-reducers into 825303b on coryhouse:master.

@@ -41,6 +41,7 @@ describe('Reducers::FuelSavings', () => {
}
};
};
const dateModified = dateHelper.getFormattedDateTime(new Date());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing new Date() is unnecessary here since it mirrors the default param

@coryhouse coryhouse merged commit 85fbfbe into coryhouse:master Aug 19, 2016
@coryhouse
Copy link
Owner

Thanks for the PR @samit4me ! Great work! 👍

@samit4me
Copy link
Contributor Author

Wow that was quick, thanks.

@kwelch
Copy link
Collaborator

kwelch commented Aug 22, 2016

@samit4me Congrats on the PR! 👍

@samit4me samit4me deleted the 240-pure-reducers branch August 23, 2016 03:16
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.

5 participants