You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to test the put.resolve when I pass it a Promise instead of object?
Here is my code:
constregistry=newWeakMap()constdefer=action=>{returndispatch=>newPromise((resolve,reject)=>{// register the callbacks and use it to resolve/reject laterregistry.set(action,{resolve, reject})dispatch(action)})}function*handleSaga(){constaction=yieldtake('MY_ACTION')fetch('MY_API').then(result=>registry.get(action).resolve(result),reason=>registry.get(action).reject(reason))}function*rootSaga(){yieldput.resolve(defer({type: 'MY_ACTION'}))}
Hello,
Is there any way to test the
put.resolve
when I pass it a Promise instead of object?Here is my code:
And the test:
But it's failed because the result of
defer()
is a Promise, not a plain object.I know I can create a middleware to handle the promise and put a plain object instead but I want to keep it simple.
Thanks.
The text was updated successfully, but these errors were encountered: