Reliable way to test Process.send_after/4

I use mox for that.

defmodule Recurrent do
  @callback send_after(pid(), any(), non_neg_integer()) :: :ok
end

defmodule Recurrent.Impl do
  @behaviour Recurrent
  @impl Recurrent
  def send_after(pid, message, milliseconds),
    do: Process.send_after(pid, message, milliseconds)
end

That way you already have a single place to do whatever else while sending a message, like telemetrying it, or writing a log, or something. The testing becomes as easy as defining a mock for it.