Unit Testing - Mocking API Calls



I’m using JavaScript as opposed to TypeScript and have a handler that makes an API call. What strategies are you using?

Without dependency injection support in Jovo, one thought I had was to wrap the service call in a Jovo PlugIn and then use a ‘unit-test’ stage that enables the mock plugin vs the real one.

Or maybe a Hook listens for the request and determines the stage and adds the correct service function onto the request object.


Hi Mark,
I think this feature proposal should be able to solve this: