aws / amazon-chime-sdk-component-library-react

Amazon Chime React Component Library with integrations with the Amazon Chime SDK.
Apache License 2.0
269 stars 160 forks source link

[FEATURE REQUEST] Expose Contexts to allow for mocking #967

Open tr00st opened 1 month ago

tr00st commented 1 month ago

Community Note

Tell us about your request

What do you want us to build?

Specifically in the Chime React Component Library. We'd find it really helpful to have access to the Contexts used to link the various Providers to their Hooks.

Tell us about the problem you are trying to solve and why is it hard?

For a lot (all?) of the Provider components, they provide a Context that's used to attach the state for the relevant Hooks for use further down the component tree. This leaves a couple of issues:

We use Storybook for visual diffs/component-level UI testing. For that, we use small chunks of the component tree, to provide deterministic+reproducible views. However - if our components depend on

How are you currently solving a problem?

We currently spend extra time refactoring our components out to split out the hooks to detach them from our code (think Container pattern). This is technically viable, but slows development and iteration down. Happy to hear other alternatives

Additional context

Happy enough to put a PR together for this, just want to know if it's a desired change or not before I sink time into it.