The prompt
750 charactersWrite comprehensive unit tests for the following function using .
```
```
Generate tests covering:
1. **Happy path** — Normal, expected inputs and outputs
2. **Edge cases** — Empty inputs, single elements, maximum values, boundary conditions
3. **Invalid inputs** — Wrong types, null/undefined, malformed data
4. **Error scenarios** — What should throw or return error states
5. **Concurrency/timing** — If applicable, race conditions or async edge cases
For each test:
- Give it a descriptive name that explains what it verifies
- Include a brief comment on WHY this case matters
- Use arrange-act-assert pattern
After the tests, list any additional scenarios that would require integration tests rather than unit tests.750 characters