refactor test helpers