Write unit test (setTimeout, etc.)