Refactor tests using collect-events