Skip to content

Commit

Permalink
fix replaceReducer type (reduxjs#3507)
Browse files Browse the repository at this point in the history
* fix replaceReducer type

* remove extraneous type

* Update the JSDoc so IDEs don't complain.

* new test for replaceReducers


Co-authored-by: Tim Dorr <[email protected]>
Former-commit-id: 65ca503
Former-commit-id: e90d501
  • Loading branch information
cellog and timdorr committed Aug 16, 2019
1 parent f62206a commit d44e9ec
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.d.ts.REMOVED.git-id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
50e8d018faee8887ed82337fcd1993ad07df0968
2fc2af4c9eb4ea9e5952cc465881eed93434efcd
2 changes: 1 addition & 1 deletion src/createStore.js.REMOVED.git-id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cef9a2ecaeff319d4986af24babf1c79ec9912c6
57c57d7636d7bc54dd85411f400e868fdd912ed6
18 changes: 18 additions & 0 deletions test/replaceReducers.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { createStore, combineReducers } from '..'

describe('replaceReducers test', () => {
it('returns the original store', () => {
const nextReducer = combineReducers({
foo: (state = 1, _action) => state,
bar: (state = 2, _action) => state
})
const store = createStore((state, action) => {
if (state === undefined) return 5
return action
})

const nextStore = store.replaceReducer(nextReducer)

expect(nextStore).toBe(store)
})
})

0 comments on commit d44e9ec

Please sign in to comment.