My app has a workflow where it calls out to an external service and receives a response. Sometime after that, the external service will eventually call an endpoint in my app. For integration testing, is it possible to setup an imposter with Mountebank to mimic this behavior?
In my research, my best guess is to use an injection and then maybe setTimeout() to later perform the POST request I need to make. However, I'm not sure that this is what Mountebank was intended to do.
Thanks!
You're right that this is stretching mountebank's functionality a bit, but there are at least three options. You identified the first, using injection and a setTimeout(). You might be able to do effectively the same thing with a decorator behavior and a setTimeout without having to build the entire response in JavaScript. The third option would be to use a shellTransform behavior, which lets you shell out to another program that could be responsible for the delayed behavior.