Skip to content

Commit 8cb6218

Browse files
committed
Renames lastAction to done to be consistent.
1 parent 40ae17c commit 8cb6218

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/recipes/WritingTests.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ const middlewares = [thunk];
113113
/**
114114
* Creates a mock of Redux store with middleware.
115115
*/
116-
function mockStore(getState, expectedActions, onLastAction) {
116+
function mockStore(getState, expectedActions, done) {
117117
if (!Array.isArray(expectedActions)) {
118118
throw new Error('expectedActions should be an array of expected actions.');
119119
}
120-
if (typeof onLastAction !== 'undefined' && typeof onLastAction !== 'function') {
121-
throw new Error('onLastAction should either be undefined or function.');
120+
if (typeof done !== 'undefined' && typeof done !== 'function') {
121+
throw new Error('done should either be undefined or function.');
122122
}
123123

124124
function mockStoreWithoutMiddleware() {
@@ -132,8 +132,8 @@ function mockStore(getState, expectedActions, onLastAction) {
132132
dispatch(action) {
133133
const expectedAction = expectedActions.shift();
134134
expect(action).toEqual(expectedAction);
135-
if (onLastAction && !expectedActions.length) {
136-
onLastAction();
135+
if (done && !expectedActions.length) {
136+
done();
137137
}
138138
return action;
139139
}

0 commit comments

Comments
 (0)