Book Image

Mastering PhoneGap Mobile Application Development

By : Kerri Shotts
Book Image

Mastering PhoneGap Mobile Application Development

By: Kerri Shotts

Overview of this book

PhoneGap is a useful and flexible tool that enables you to create complex hybrid applications for mobile platforms. In addition to the core technology, there is a large and vibrant community that creates third-party plugins that can take your app to the next level. This book will guide you through the process of creating a complex data-driven hybrid mobile application using PhoneGap, web technologies, and third-party plugins. A good foundation is critical, so you will learn how to create a useful workflow to make development easier. From there, the next version of JavaScript (ES6) and the CSS pre-processor SASS are introduced as a way to simplify creating the look of the mobile application. Responsive design techniques are also covered, including the flexbox layout module. As many apps are data-driven, you'll build an application throughout the course of the book that relies upon IndexedDB and SQLite. You'll also download additional content and address how to handle in-app purchases. Furthermore, you’ll build your own customized plugins for your particular use case. When the app is complete, the book will guide you through the steps necessary to submit your app to the Google Play and Apple iTunes stores.
Table of Contents (19 chapters)
Mastering PhoneGap Mobile Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Writing tests using Chai


Chai is an assertion library. Instead of needing to write several variations of assert, Chai provides several different methods that we can use to create tests that are easy to read. Chai also uses method chaining to create a more English-like version of the test, so they are both easy to read and write.

Note

For more information on Chai, visit http://www.chaijs.com.

Chai is useful because it allows us to write expressive tests without a lot of work. It also caters to you, the developer, by letting you choose one of several provided interfaces. There are three:

  • assert: Tests use an assert-styled interface, akin to what we used in the prior section. There are a lot of utility methods that you can use, such as assert.typeOf, assert.equal, and more. One can also just use assert(expression, message) as we did in the previous section.

  • expect: Tests use expect and method chaining to form an English-like statement. For example, expect(x).to.equal(5) or expect(a).to.have.property...