Closed ThomWright closed 8 months ago
Happy to add it, just left a couple of minor comments ππ»
Thanks, I pushed some fixes.
@conradludgate has a better idea (of course!): a method which waits until the expectations are satisfied without polling, with presumably a configurable timeout.
I'll let him do the hard work on that one π
Talk to me about it @conradludgate π
Haha very well, I started a branch locally. Let me push it up with what I have currently.
Basically, the idea was the lean into the "poll" approach of an is_satisfied
API and make it a Future
/async setup instead. So the MockServer will trigger a waker and wake up all those who are waiting for a satisfied event
I think they could live next to each other, but it'd be nice to offer bothβI left some comments on the other PR @conradludgate
Closing this since we merged Conrad's work.
The intention here is to make it easier to handle situations where we don't know when to expect the mock to be called.
For example, when testing async message consumers, the tests might publish a message and need to assert that the message consumer sent an HTTP request.
Unlike request/response-style HTTP endpoints, the tests don't know when the message consumer has finished processing.
In these cases, one technique is to wait for an expected condition to become true, e.g. a mock being called!
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.