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
WEB APP TESTING USING KNOCKOUT.JS

You're reading from  WEB APP TESTING USING KNOCKOUT.JS

Product type Book
Published in Nov 2014
Publisher
ISBN-13 9781783982844
Pages 154 pages
Edition 1st Edition
Languages
Author (1):
ROBERTO MESSORA ROBERTO MESSORA
Author Profile Icon ROBERTO MESSORA
ROBERTO MESSORA
Toc

Spies


A test double is a fundamental topic, which talks about unit testing. Jasmine provides its own implementation called spies.

Note

A test double is a particular object used to replace another object originally involved in the code under the test. Usually, a test double is a simplified version of the original one that behaves the same way and can be easily controlled during the test execution. The objective is to isolate the test execution context from everything that is not directly related to the test subject. In other words, if we want to test the behavior of a particular object that has some sort of interaction with other objects, we need something to tightly control the latter so that we can accurately define the execution context.

A spy is a function that can stub any other function and track all the calls and every argument passed. The following example (03_03_specs.js) shows the basic spy functionality. Remember that here we want to show how it works technically, not how we can take...

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 R$50/month. Cancel anytime