New answers tagged

1

Maybe it will help if I put this in OOP terms first. A class has public and private methods, and you unit test via the public methods. But sometimes you make calls from that class into other classes, and those classes also have their public methods unit tested, even though those public methods are technically implementation details of the first class. ...


6

It's not the size of the function. It's how it's used. Let's take some well tested functions, + - * and Math.sqrt(), and compose them into a distance function: function getDistance(xA, yA, xB, yB) { var xDiff = xA - xB; var yDiff = yA - yB; return Math.sqrt(xDiff * xDiff + yDiff * yDiff); } kirupa - using the pythagorean theorem to measure ...


Top 50 recent answers are included