Skip to content

Commit

Permalink
Fix for issue #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 authored and arnaudbenard committed Jan 8, 2016
1 parent 4e08215 commit 718abd8
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 @@ -44,6 +44,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 @@ -115,12 +115,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);
}
});

Expand Down

0 comments on commit 718abd8

Please sign in to comment.