developit / unistore

🌶 350b / 650b state container with component actions for Preact & React
https://npm.im/unistore
2.86k stars 139 forks source link

How to use Unistore action in JEST for shallow testing? #181

Open MdAyman7 opened 5 years ago

MdAyman7 commented 5 years ago

I am facing an error while testing my react app from JEST. It shows an error as "TypeError: Cannot read property 'action' of undefined". Can I know how do I solve this error?

ashnehete commented 4 years ago

I was facing the same error message. To solve it, I wrapped the Component around Provider. mount(<Provider store={store}><Component /></Provider>)

zgoda commented 3 years ago

Unfortunately shallow(<Provider store={store}><ConnectionBox /></Provider>).debug() produces <i /> and I am not sure what I can do with it.