Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Jasmine Cookbook
  • Table Of Contents Toc
Jasmine Cookbook

Jasmine Cookbook

By : Munish Kumar
4.3 (7)
close
close
Jasmine Cookbook

Jasmine Cookbook

4.3 (7)
By: Munish Kumar

Overview of this book

If you are a competent JavaScript developer who wants to design and implement tests using Jasmine in order to minimize bugs in the production environment, then this book is ideal for you. Some familiarity with unit testing and code coverage concepts such as branch coverage along with basic knowledge of Node.js, AngularJS, and CoffeeScript is required.
Table of Contents (11 chapters)
close
close
10
Index

Introduction

The primary objective of unit testing is to test a method, object, or component in isolation and see how it behaves in different circumstances. However, there are situations where a method/object has dependencies on other methods or objects. In this scenario, we need to design tests/specs across the units/methods or components to validate behavior or simulate a real-time scenario. However, due to non-availability of dependent methods/objects or a staging/production environment, it is quite challenging to write Jasmine tests for methods that have dependencies on other methods/objects. This is where mocks come into the picture. A mock is a fake object that replaces the original object/method and imitates the behavior of the real object, without going into the nitty-gritty of creating the real object/method.

Mocks work by implementing the proxy model. Whenever we create a mock object, it creates a proxy object, which replaces the real object/method. In our test method, we can...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Jasmine Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon