joetidee / enzyme-react-intl

A complimentary wrapper function for use with Enzyme, when testing React components that rely on react-intl
MIT License
45 stars 14 forks source link

Add getter to allow direct access to intl object #25

Closed thefossedog closed 5 years ago

thefossedog commented 5 years ago

This is to address a quirky little problem we have encountered, whereby we need to pass an intl object into one of our Redux actions. Our current workaround is :

Having an intl getter in this package will mean we can just grab the intl object with all messages/locale already set and pass it straight in to our tests (which would be lovely).

Note - I had some fun and games getting these tests running, looks like maybe mocha-webpack isn't compatible with versions of webpack newer than 3.11.0. I rolled a few things back and made a few hacks here and there to get the tests running enough that I could check my new test worked as expected. Didn't PR my hacky changes to the repo, but can do if required. https://github.com/thefossedog/enzyme-react-intl/tree/hackityhack

And finally - Awesome tool mate - thanks for your work on this