Create comprehensive unit tests for your code.
{{language}}Programming language
Example: TypeScript
{{component_type}}Type of code
Example: function
{{code}}Code to test
Example: export function validate(input) { ... }
{{testing_framework}}Testing framework
Example: Jest
Write Vitest unit tests for this TypeScript utility function with edge cases and descriptive names.