Skip to content

Commit

Permalink
Revert "Add warning when bindActionCreators encounters non-function p…
Browse files Browse the repository at this point in the history
…roperty (reduxjs#2279)" (reduxjs#2473)

This reverts commit 1b154e0.
  • Loading branch information
artgillespie authored and seantcoyote committed Jan 14, 2018
1 parent 56bd833 commit 31fa1e6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
4 changes: 0 additions & 4 deletions src/bindActionCreators.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warning from './utils/warning'

function bindActionCreator(actionCreator, dispatch) {
return (...args) => dispatch(actionCreator(...args))
}
Expand Down Expand Up @@ -44,8 +42,6 @@ export default function bindActionCreators(actionCreators, dispatch) {
const actionCreator = actionCreators[key]
if (typeof actionCreator === 'function') {
boundActionCreators[key] = bindActionCreator(actionCreator, dispatch)
} else {
warning(`bindActionCreators expected a function actionCreator for key '${key}', instead received type '${typeof actionCreator}'.`)
}
}
return boundActionCreators
Expand Down
9 changes: 0 additions & 9 deletions test/bindActionCreators.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ describe('bindActionCreators', () => {
})

it('wraps the action creators with the dispatch function', () => {
const _console = console
global.console = { error: jest.fn() }
const boundActionCreators = bindActionCreators(actionCreators, store.dispatch)
expect(
Object.keys(boundActionCreators)
Expand All @@ -33,13 +31,9 @@ describe('bindActionCreators', () => {
expect(store.getState()).toEqual([
{ id: 1, text: 'Hello' }
])
expect(console.error).toHaveBeenCalled()
global.console = _console
})

it('skips non-function values in the passed object', () => {
const _console = console
global.console = { error: jest.fn() }
const boundActionCreators = bindActionCreators({
...actionCreators,
foo: 42,
Expand All @@ -53,9 +47,6 @@ describe('bindActionCreators', () => {
).toEqual(
Object.keys(actionCreatorFunctions)
)
// 6 instead of 5 because of `__esModule: true` property from importing `actionCreators`
expect(console.error.mock.calls.length).toBe(6)
global.console = _console
})

it('supports wrapping a single function only', () => {
Expand Down

0 comments on commit 31fa1e6

Please sign in to comment.