Jul 12 2010

Writing Testable JavaScript

Writing Testable JavaScript

Some good advice about singletons, since their popular with the Module Pattern. Also true about “tight” functions, but this is true in any language.

However, I’d ignore the tip to not use private functions just so their testable. That argument doesn’t fly in any other language, and the only thing the rest of your program cares about is that the public interface does what it says it does. That’s the point of unit testing: guaranteeing the public API contract.

  • #javascript