test refactor to reduce duplication