relay: minor refactoring to tests