Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
JavaScript Mobile Application Development

You're reading from  JavaScript Mobile Application Development

Product type Book
Published in Oct 2014
Publisher
ISBN-13 9781783554171
Pages 332 pages
Edition 1st Edition
Languages
Toc

Table of Contents (15) Chapters close

JavaScript Mobile Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. An Introduction to Apache Cordova 2. Developing Your First Cordova Application 3. Apache Cordova Development Tools 4. Cordova API in Action 5. Diving Deeper into the Cordova API 6. Developing Custom Cordova Plugins 7. Unit Testing the Cordova App's Logic 8. Applying it All – the Mega App Index

Writing your first Jasmine test


Before writing our first Jasmine test, we need to understand the difference between a suite and a spec (test specification) in Jasmine. Jasmine suite is a group of test cases that can be used to test a specific behavior of the JavaScript code. In Jasmine, the test suite begins with a call to the describe Jasmine global function that has two parameters. The first parameter represents the title of the test suite, while the second parameter represents a function that implements the test suite.

A Jasmine spec represents a test case inside the test suite. In Jasmine, the test case begins with a call to the Jasmine global function it that has two parameters. The first parameter represents the title of the spec and the second parameter represents a function that implements the test case.

A Jasmine spec contains one or more expectations. Every expectation represents an assertion that can be either true or false. In order to pass the specs, all of the expectations inside...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}