it could be to make the code behaves more like real life.

But I'd either remove the setTimeout or add a method to call the callback in a synchronous way, that you'd call in the test. Using a setTimeout is a good way to be hurt.