Added a test for test helper 'wait' to check for pending timers

First step in analyzing #3008.