Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
JavaScript at Scale

You're reading from   JavaScript at Scale Build web applications that last, with scaling insights from the front-line of JavaScript development

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781785282157
Length 266 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Adam Boduch Adam Boduch
Author Profile Icon Adam Boduch
Adam Boduch
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Scale from a JavaScript Perspective 2. Influencers of Scale FREE CHAPTER 3. Component Composition 4. Component Communication and Responsibilities 5. Addressability and Navigation 6. User Preferences and Defaults 7. Load Time and Responsiveness 8. Portability and Testing 9. Scaling Down 10. Coping with Failure Index

Testing mock scenarios


The more our application scales, the more scenarios it'll have to deal with. This is the result of more users using more features, and all the ensuing complexity our code has to handle. Having mock data and unit tests can really help put these scenarios to the test. In this section, we'll go over some of the options available to us for creating these mock scenarios and then testing them, both with our unit tests and by interacting with the system as a user.

Mock APIs and test fixtures

Mock data is valuable to us for many reasons, one of which is unit tests. If we're mocking the API, we can run our unit tests as though our code is hitting a real API. We have fine-grained control over individual data points in our mock data, and we're free to change it how we see fit—it's sandboxed data, it has no negative effect on the outside world. Even if we're generating our mock data using a tool, we can get in there and shuffle things about.

Some unit testing tools accept fixtures...

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 $19.99/month. Cancel anytime
Banner background image