Refactor search tests