Book Image

JavaScript at Scale

By : Adam Boduch
Book Image

JavaScript at Scale

By: Adam Boduch

Overview of this book

Have you ever come up against an application that felt like it was built on sand? Maybe you've been tasked with creating an application that needs to last longer than a year before a complete re-write? If so, JavaScript at Scale is your missing documentation for maintaining scalable architectures. There's no prerequisite framework knowledge required for this book, however, most concepts presented throughout are adaptations of components found in frameworks such as Backbone, AngularJS, or Ember. All code examples are presented using ECMAScript 6 syntax, to make sure your applications are ready for next generation browsers.
Table of Contents (12 chapters)
11
Index

Unit testing tools


It's time to turn our attention to testing, having covered the basics of mocking API endpoints at scale. Our ability to mock APIs is highly relevant to testing our code, because we can test against those same mocks, or at least the same data. This means that if our tests fail, we can start interacting with the UI if we need to, using the same data that failed the test, trying to figure out what's happening.

We'll look into using the unit testing tools that ship with JavaScript frameworks, and figure out where their value lies. We'll also look at using more generic standalone testing frameworks that run with any code. We'll close out the section with a look at how our tests can be automated, and how this automation fits into our development workflow.

Tools built into frameworks

If we're using one of the larger, all-encompassing JavaScript application frameworks, there's a good chance that it will ship with some unit testing tools. These aren't meant to replace the existing...