fixed test to handle events properly