DEV Community

Discussion on: Unit testing & integration explained with math functions

Collapse
 
iquardt profile image
Iven Marquardt

In FP hard-coded dependencies are avoided most of the time, because we can easily pass the dependency as a function argument, which converts the function into a higher order one. Additionally, HOFs are more general than first order functions.

Collapse
 
alfdocimo profile image
Alfredo Narváez Docimo

You're totally right! I think FP is quite a broad subject in itself and when it comes to testing it makes it very easy not having to mock dependencies. For people wondering, it might end up looking a bit like this:
Alt-text

Thanks for your feedback! 💙