Refactored tests into helpers