optimizely / fullstack-labs

Apache License 2.0
13 stars 8 forks source link

chore (ReactSDK Exports): Export the context provider/consumer pair to assist with unit testing #42

Closed jamesopti closed 4 years ago

jamesopti commented 5 years ago

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:

import { OptimizelyContextProvider } from '@optimizely/react-sdk';
...
mount(<MyComponent />, { context: { OptimizelyContextProvider } } )
carynligon commented 5 years ago

PLEASE 🙏

jamesopti commented 4 years ago

Closing this - See https://github.com/optimizely/react-sdk/pull/10 for more discussion.