Allow passing named parameters to testAction function
requested to merge 21775-helpers-vuex_action_helper-function-is-a-little-bit-confusing-to-use into master
testAction
has too many parameters. This allows it to be used with named args instead (using a single object). Update in backwards-compat way (I hope!) so we don't need to replace old instances right now.
Usage examples:
before (thought-process comments added for emphasis):
testAction(
actions.fetchIssuesForList, // ok this is action so far so good
{ listId }, // initial state I guess?
{}, // ?? oh wait this is actually state. Previous param must be payload
[{ // ???
type: types.REQUEST_ISSUES_FOR_LIST, // oh ok this is expected mutations
payload: { listId, fetchNext: false } // this is fine
}],
[], // ???
done, // I hope I added enough empty arrays
);
after:
testAction({
action: actions.moveList,
payload: { listId },
expectedMutations: [{
type: types.REQUEST_ISSUES_FOR_LIST,
payload: { listId, fetchNext: false },
}],
done,
});
Edited by Simon Knox