The best place to start learning about how to test your Angular code is the Unit Testing section of the AngularJS Developer Guide. Some of the important takeaways from the guide are that
- dependency injection is the best way to get ahold of dependencies for testing purposes. Angular has this built in, but you can help by not manipulating the DOM in your application (e.g., controller) logic.
- use the $compile service to bind scope to a directive's DOM for testing
Some other helpful practices I've discovered through experience: