refactored test duplication into helper