SinonJS Fundamentals

SinonJS is one of the most popular JavaScript libraries for test doubles. This course walks through the various features of SinonJS so that you know not only how to use each feature, but more importantly, why you would use each one.
Course info
Rating
(11)
Level
Intermediate
Updated
Jul 2, 2018
Duration
2h 22m
Table of contents
Course Overview
The State of Testing at Globomantics
Spying on Functions
Swapping a Stub for a Function
Verifying Behavior with Mocks
Controlling How Parameters Are Matched
Faking out XHR and Timer Calls
Easier Set up and Clean up with Sandboxes
What’s Next?
Description
Course info
Rating
(11)
Level
Intermediate
Updated
Jul 2, 2018
Duration
2h 22m
Description

Unit testing can be hard, particularly when you're testing against live systems. Data from databases can change, APIs can be down, and accessing file systems can be slow. Using test doubles in your unit tests can help alleviate a lot of the struggles and issues you might experience. In this course, SinonJS Fundamentals, you'll learn how the SinonJS library can help make unit testing easier and more repeatable. First, you'll explore each of the test doubles that Sinon offers. Not only will you learn the syntax, but with the hands-on demos, you'll see how and when to use each test double. Next, you'll delve into other utilities that Sinon offers that simplify checking that the right data was returned. Then, you'll discover how Sinon can help you even with the hard problems of testing, such as faking out dates or XHR data in the browser. Finally, you'll learn how the Sinon ecosystem works to make it easier for you to stay on top of all of your test doubles. By the end of the course, you'll be able to incorporate Sinon into your projects to ensure quick, repeatable test results.

About the author
About the author

Nate's first program was written in QBasic on an 8086 clone his dad built. Since then he's written applications in C++, .NET, and Node.js.

More from the author
JavaScript Promises and Async Programming
Intermediate
1h 21m
Nov 26, 2019
Managing Files with Node.js
Beginner
1h 27m
Oct 18, 2019
Storybook: Getting Started
Beginner
1h 54m
Jun 14, 2019
More courses by Nate Taylor
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is Nate Taylor, and welcome to my course, SinonJS Fundamentals. I am a lead software developer at Aviture in Omaha, Nebraska. Writing tests can be hard, but by figuring out how to fake out specific functions, you can make your testing a little bit easier. This course will walk you through the basics of Sinon. JS, a popular test double library in JavaScript. It will help you get up and running so that you can start using it in your projects. Some of the major topics that we'll cover include spies, stubs, mocks, and other fake functions that you can use with Sinon. By the end of the course, you'll be able to install Sinon and use it to fake out functions to help your unit tests be isolated. You'll also have a good understanding of the Sinon. JS idioms, and even get exposed to some of the available libraries that you can use. Before beginning the course, you should be familiar with unit testing, as well as JavaScript. I hope you'll join me on this journey to learn test doubles with the SinonJS Fundamentals course, at Pluralsight.