refactor a test function to avoid string typing