redux-saga-test-engine icon indicating copy to clipboard operation
redux-saga-test-engine copied to clipboard

Unable to pass `undefined` as mock return value

Open steevsachs opened this issue 6 years ago • 1 comments

Currently an Env mapping is missing a value for... error will be thrown when a mapping specifies undefined as its return value, ie

[call(shouldReturnUndefined), undefined]

due to the check on line 164 of core.js:

var nextValFound = nextVal !== undefined;

I believe undefined is a valid return value, so this throw condition seems to be in error. The absence of a return value should instead be caught by isNestedArray, which confirms the array has a length of 2.

My suggested fix would be to remove line 164 (happy to do a PR!), but raising an issue to confirm there's not some other reasoning behind this assertion.

steevsachs avatar Aug 02 '18 14:08 steevsachs

@steevsachs I think that's a fair point. Happy to receive a PR on it! :-)

timbuckley avatar Aug 02 '18 16:08 timbuckley