Book Image

AngularJS Web application development Cookbook

By : Matthew Frisbie
Book Image

AngularJS Web application development Cookbook

By: Matthew Frisbie

Overview of this book

Packed with easy-to-follow recipes, this practical guide will show you how to unleash the full might of the AngularJS framework. Skip straight to practical solutions and quick, functional answers to your problems without hand-holding or slogging through the basics. Avoid antipatterns and pitfalls, and squeeze the maximum amount out of the most powerful parts of the framework, from creating promise-driven applications to building an extensible event bus. Throughout, take advantage of a clear problem-solving approach that offers code samples and explanations of components you should be using in your production applications.
Table of Contents (17 chapters)
AngularJS Web Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Writing DAMP tests


Any seasoned developer will almost certainly be familiar with the Don't Repeat Yourself (DRY) programming principle. When architecting production applications, the DRY principle promotes improved code maintainability by ensuring that there is no logic duplication (or as little as feasibly possible) in order to allow efficient system additions and modifications.

Descriptive And Meaningful Phrases (DAMP) on the other hand promotes improved code readability by ensuring that there is not too much abstraction to cause the code to be difficult to understand, even if it is at the expense of introducing redundancy. Jasmine encourages this by providing a Domain Specific Language (DSL) syntax, which approximates how humans would linguistically declare and reason about how the program should work.

How to do it…

The following tests are a sample of unit tests from the Writing basic unit tests recipe, presented here unchanged:

  it('should display invalid handle for insufficient characters...