How should we mock Sendbird requests to force error cases?

Hello, we’ve got some good results using Sendbird SDK for our application. However, we’re ready to start testing error scenarios and need to test our code that runs when sendbird API requests fail. There are quite a few scenarios to consider but is there a recommended debugger tool of some sort where we can forcibly fail Sendbird requests locally in the browser?

We’ve tried spinning up a proxy but the sendbird URLs are derived from the user’s API key so it’s not as straightforward as how we would mock our other requests.

Thanks for any information or advice!

@mkay581 If you attempts to use most of methods without using connect method, you can simulate fail requests.

Sure but we actually need the connect call. We want to test the errors for other sendbird requests.

I wonder if something like would be of use. You could mock the calls that Sendbird is making and return failures.

Oh yes, we’re already using Jest to mock our sendbird wrapper calls in unit tests. But like mentioned in my original post, we need to be able to mock the actual sendbird calls in the browser so that our QA team can test when failures are returned from sendbird calls. We can’t do that by mocking calls in unit tests.

Apologizes for that. I misunderstood what you were looking for. I’m trying to do some research to see if there is anything that fits what you’re needing but thus far I’m coming up short. I’ll let you know if I do find anything.

No worries. Yeah we’re already using tools that allow QA team to successfully intercept all other requests in the browser. This problem is scoped to Sendbird requests specifically because the hostname in the request URL to Sendbird’s API is dynamically generated by the user’s session id from the connect call.

You can mock like this

every {
} answers {