Reliable way to test Process.send_after/4

Testing things that happen in isolation within an external process can either be polled (sleep) or you make the process inform the test (it sending a message when it did the thing). Your option here really is the latter.

I lately have sometimes gone the way of doing the latter through telemetry. I add a telemetry emit to the thing I’m interested in and in the test add a handler, which sends a message to the test process. I like this one for it being very not a home grown system, not specific to the tested process and also generally being a useful guidance on where telemetry might be useful given I also want to test it.