There are a couple of circumstances in my app where I need to use setTimeout
and I’ve had success testing them by stubbing it globally with a function that calls the original setTimeout
with zero delay (using Sinon). The same approach should work with Ember.run.later
, either by stubbing it directly, or stubbing setTimeout
like I did since backburner ends up calling it anyway.
The other alternative is to make that delay value an app-level config setting that the testing harness can override. This approach has the added benefit of being able to tweak subjective settings later without code change.