Amy Blankenship
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.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

No responses yet