Skip to content

Commit

Permalink
Fix for issue reduxjs#7
Browse files Browse the repository at this point in the history
In the test though I’m not sure how to properly catch the failing mock
test and test it’s error state
  • Loading branch information
subblue committed Jan 5, 2016
1 parent 461f7ca commit 77fc9a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Expand Up @@ -36,6 +36,9 @@ export default function configureStore(middlewares = []) {
}
return action;
} catch (e) {
if (done) {
done(e);
}
throw e;
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/index.js
Expand Up @@ -86,12 +86,12 @@ describe('Redux mockStore', () => {
it('handles multiple actions', done => {
const store = mockStore({}, [{ type: 'ADD_ITEM' }, { type: 'REMOVE_ITEM' }], done);
try {
store.dispatch({ type: 'ADD_ITEMS' });
store.dispatch({ type: 'UNEXPECTED_ACTION' });
store.dispatch({ type: 'REMOVE_ITEM' });
} catch (e) {
expect(e.actual.type).toBe('ADD_ITEMS');
expect(e.actual.type).toBe('UNEXPECTED_ACTION');
expect(e.expected.type).toBe('ADD_ITEM');
done();
// done(e);
}
});
});

0 comments on commit 77fc9a0

Please sign in to comment.