Unit Testing

  1. Test at the lowest possible level. A single class or Javascript module.
  2. Mock dependencies instead of relying on real implementations.
  3. Include meaningful expectations (asserts) in the tests.
  4. Test valid as well as invalid inputs
  5. Where possible test at the interface level so the same test can be used to validate many implementations.