Closed jamesopti closed 4 years ago
In order to make unit test of components which use any of the conditional render component wrappers, export the global context instance used by <OptimizelyProvider /> so that testers can provide it to Enzyme's mount:
<OptimizelyProvider />
import { OptimizelyContextProvider } from '@optimizely/react-sdk'; ... mount(<MyComponent />, { context: { OptimizelyContextProvider } } )
PLEASE 🙏
Closing this - See https://github.com/optimizely/react-sdk/pull/10 for more discussion.
Summary
In order to make unit test of components which use any of the conditional render component wrappers, export the global context instance used by
<OptimizelyProvider />
so that testers can provide it to Enzyme's mount: