Given I have a function called sum module imported from a 3rd party module Calculator. Here's how I use it:
Calculator.sum(1, 2) // returns 3
I don't know the implementation of Calculator.sum. What if I want to modify the arguments passed to Calculator.sum before executing sum, so that instead of taking the original numbers (1, 2, 3, etc), sum will take their squared values (1, 4, 9, etc) ? For example:
Calculator.sum(1, 2) // returns 5
Calculator.sum(2, 3) // returns 13
Calculator.sum(3, 4) // returns 25
Note: This is just an example of my actual problem, I don't actually need a Calculator.sum function to calculate sum of squares 😀
sum. Just call the method with the modified values or create a new method for it. theMath"namespace" have all the functions you need for that.summethod that you expect to not actuallysumyou have either created unit tests for the wrong version or you might have to consider renaming a few things... I would recommend creating a new method in theCalculatorobject if that is what you feel you need, a method with a better name, that does what you wish. Not replace thesummethod with something that is NOTsum:P