[Question] Stubbing/Mocking redux hooks in mountHook
fayeed opened this issue · 4 comments
fayeed commented
I am trying to unit test a custom hook which also uses redux hook, like useSelector
& useDispatch
but I am getting an error that the hook is not wrapped in Provider. I am mounting the hook using mountHook
but am not sure how to get around the provider issue. Any help is appreciated.
Internally the mountHook
call the hook inside a component, so I was wondering if there is a way we can change that, or if there is any other work around to go over this issue.
bahmutov commented
Can you submit PR with a reproducible example?
…Sent from my iPhone
On Nov 12, 2020, at 11:33, Fayeed Pawaskar ***@***.***> wrote:
I am trying to unit test a custom hook which also uses redux hook, like useSelector & useDispatch but I am getting an error that the hook is not wrapped in Provider. I am mounting the hook using mountHook but am not sure how to get around the provider issue. Any help is appreciated.
Internally the mountHook call the hook inside a component, so I was wondering if there is a way we can change that.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
fayeed commented
bahmutov commented
The release is available on:
Your semantic-release bot