Would you mind writing a unit test for this function?