Refactor tests for DRY