|
|
|
|
|
by joebadmo
4335 days ago
|
|
If you really want to buy into the module pattern, it seems like anything that's enough of a unit that you'd want to test could be in its own module. In the example given, the sum function could be its own module that you require into the stats module. That way you could test them independently, and the stats module could simply expose its own appropriate methods. This has the added benefit of making the sum function reusable. Personally I prefer this approach to introducing environmental concerns into your code. |
|
I'm also not sure I buy the assertion that all code you would want to test is code you would want to export publicly. Do you have any reasoning to support that idea?