Skip to content

Commit 91e6281

Browse files
committed
Fix should assertion
1 parent ed1e513 commit 91e6281

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/assertions/toDispatchActionsWithState.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function toDispatchActionsWithState(initialState, actionUnderTest, expectedActio
5353
if (!find(dispatchedActions, expectedUnrolledActions[index])) {
5454
throw new Error(
5555
`Expected action ${JSON.stringify(expectedUnrolledActions[index])} was not dispatched.`
56+
+ `\nActual dispatched actions: ${JSON.stringify(dispatchedActions)}`
5657
);
5758
}
5859
}

src/chai/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ function registerAssertions() {
1818

1919
const state = utils.flag(this, 'state');
2020
if (state) {
21-
assertions.toDispatchActionsWithState(state, this._obj, expectedActions, done);
22-
} else {
23-
assertions.toDispatchActions(this._obj, expectedActions, done);
21+
return assertions.toDispatchActionsWithState(state, this._obj, expectedActions, done);
2422
}
23+
return assertions.toDispatchActions(this._obj, expectedActions, done);
2524
}
2625

2726
function isDispatchingWithState(actualAction, expectedActions, state, done) {

src/should/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ function dispatchActions(expectedActions, done) {
1515
const action = this.obj.action;
1616
const state = this.obj.state;
1717
assertions.toDispatchActionsWithState(state, action, expectedActions, done);
18+
} else {
19+
assertions.toDispatchActions(this.obj, expectedActions, done);
1820
}
19-
assertions.toDispatchActions(this.obj, expectedActions, done);
2021
}
2122

2223
function registerAssertions() {

test/should/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('should', () => {
2929

3030
it('should have alias .state', (done) => {
3131
should(actions.actionCreatorWithGetState())
32-
.with.state(() => { return { property: 'value1' };})
32+
.with.state(() => { return { property: 'value' };})
3333
.dispatchActions(actions.actionWithGetState({ property: 'value' }), done);
3434
});
3535
});

0 commit comments

Comments
 (0)