A sampling of code with tests based on AngularJS