I’m working on a React component that uses SendbirdProvider, and I’m now looking into how to automate testing for it. I plan to use Storybook’s play function for the tests.
To avoid hitting the actual Sendbird backend during tests, I want to mock the component in a way that returns predefined data every time the test runs. I’m currently considering two approaches:
-
Wrap the component with a mocked version of SendbirdProvider. I’m not sure if Sendbird offers a built-in mock provider for this.
-
Mock the useSendbirdStateContext hook to return relevant mocked functions and data.
I’d appreciate any advice on which of these approaches is better—or if there’s a more effective alternative.