Book Image

Jasmine Cookbook

By : Munish Kumar
Book Image

Jasmine Cookbook

By: Munish Kumar

Overview of this book

Table of Contents (16 chapters)
Jasmine Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Organizing Jasmine specs into groups and subgroups


Whenever code expands and becomes complex, we can segregate and categorize the Jasmine specs corresponding to a specific feature or component. In this recipe, you will learn how to organize Jasmine specs into groups and subgroups. Jasmine provides the describe global function to define group-related specs. The string parameter of the describe function is used to name the collection of specs, which represents a specific feature or component. This helps in finding specs and corresponding JavaScript code in a large suite. The name of the collection of specs is further concatenated with the name(s) of subgroup(s) to make a spec's full name. Moreover, if we name them well, we can read specs as a full sentence.

You will learn this recipe with the help of the second recipe in this chapter, Implementing the Jasmine test corresponding to the specs.

How to do it...

You need to perform the following steps to write the organized Jasmine specs into groups...