Jul 14, 2024
Your unit tests apparently aren't very good, because in the original code the push only happens if the user.experience and user.role conditions are met. If you just map it, you're going to have malformed or null elements in there. You need a filter either before or after, or you need to use reduce + push.