Skip to content

Commit e4cfaf5

Browse files
jimbollatimdorr
authored andcommitted
Deletes no-longer-valid applyMiddleware test.
Behavior has been replaced with the "it warns when dispatching during middleware setup" test in the 'next' branch.
1 parent 6d402a2 commit e4cfaf5

File tree

1 file changed

+15
-30
lines changed

1 file changed

+15
-30
lines changed

test/applyMiddleware.spec.js

+15-30
Original file line numberDiff line numberDiff line change
@@ -104,40 +104,25 @@ describe('applyMiddleware', () => {
104104
})
105105

106106
it('passes through all arguments of dispatch calls from within middleware', () => {
107-
const spy = jest.fn()
108-
const testCallArgs = ['test']
109-
function multiArgMiddleware() {
110-
return next => (action, callArgs) => {
111-
if (Array.isArray(callArgs)) {
112-
return action(...callArgs)
113-
}
114-
return next(action)
107+
const spy = jest.fn()
108+
const testCallArgs = ['test']
109+
110+
function multiArgMiddleware() {
111+
return next => (action, callArgs) => {
112+
if (Array.isArray(callArgs)) {
113+
return action(...callArgs)
115114
}
115+
return next(action)
116116
}
117-
function dummyMiddleware({ dispatch }) {
118-
return next => action => dispatch(action, testCallArgs)
119-
}
120-
121-
const store = createStore(reducers.todos, applyMiddleware(multiArgMiddleware, dummyMiddleware))
122-
store.dispatch(spy)
123-
expect(spy.mock.calls[0]).toEqual(testCallArgs)
124-
})
125-
126-
it('keeps unwrapped dispatch available while middleware is initializing', () => {
127-
// This is documenting the existing behavior in Redux 3.x.
128-
// We plan to forbid this in Redux 4.x.
117+
}
129118

130-
function earlyDispatch({ dispatch }) {
131-
dispatch(addTodo('Hello'))
132-
return () => action => action
119+
function dummyMiddleware({ dispatch }) {
120+
return next => action => dispatch(action, testCallArgs)
133121
}
134122

135-
const store = createStore(reducers.todos, applyMiddleware(earlyDispatch))
136-
expect(store.getState()).toEqual([
137-
{
138-
id: 1,
139-
text: 'Hello'
140-
}
141-
])
123+
const store = createStore(reducers.todos, applyMiddleware(multiArgMiddleware, dummyMiddleware))
124+
125+
store.dispatch(spy)
126+
expect(spy.mock.calls[0]).toEqual(testCallArgs)
142127
})
143128
})

0 commit comments

Comments
 (0)