Refactor tests to be more DRY