You can extract the timeout functionality into its own structure then and mock it out during testing.
There's usually a solution of some sort, it might just require a bit of rearranging and extraction of concerns.
There's usually a solution of some sort, it might just require a bit of rearranging and extraction of concerns.
Create a Timeout class and subscribe to it for a given interval with a callback to what needs to be run. Pass it in as a dependency which can be mocked during testing.
Not sure why the downvotes...