Don't rely on timer:sleep/1 in test case

This both speeds the test up and should be more robust.