Learn Javascript Unit Testing With Mocha, Chai and Sinon
3.2 (270 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
968 students enrolled

Learn Javascript Unit Testing With Mocha, Chai and Sinon

Learn to write unit tests with Mocha Chai and Sinon as well as learning how to TDD the right way
3.2 (270 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
968 students enrolled
Created by Tyler Pedley
Last updated 8/2017
English
English [Auto]
Current price: $12.99 Original price: $19.99 Discount: 35% off
15 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 40 mins on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Write unit tests using Mocha, Chai and Sinon
  • Setup a new project that is ready for unit testing
  • Create programs following the TDD (Test Driven Development) patterns
  • Learn how to write more reliable and robust code
  • Learn how to expand your test suites with mocks, stubs and spies
  • Learn the use of spies and when to use them
  • Learn the use of stubs and when to use them
  • Learn the use of mocks and when to use them
Course content
Expand all 14 lectures 40:04
+ Introduction
2 lectures 03:42

In this video I will show you how to test a new node project ready for us to use to create a test suite.

Preview 03:04
+ Introduction To Unit Testing
2 lectures 09:59

In this video you will learn about Unit Testing and see some examples of real unit tests. You will understand what unit tests are and why they are important

Preview 05:35

A quick quiz to cover the topics in the first section.

Unit Testing Basics
3 questions
+ Mocha
2 lectures 04:13

A quick introducing to MochaJS to prepare for the next video where we will use Mocha to create a test suite

What is Mocha?
00:47

In this video I take you over the creation of a test suite for a simple calculator app and explain what each part of the suite does. We create a foundation for the following videos

Using Mocha to prepare a test suite
03:26
+ Chai
4 lectures 07:34

An introduction to Chai and why it is so popular. I give an overview of the library and what it is used for 

What is Chai?
00:55
Chai - Should
02:10
Chai - Expect
02:36
Chai - Assert
01:53
+ Sinon
4 lectures 14:36
What is Sinon?
01:48
Sinon - Spies
02:44
Sinon - Stubs
04:10
Sinon - Mocks
05:54
+ Conclusion
0 lectures 00:00

This quiz will test your understanding of Mocha, Chai and Sinon as well as your understanding of best TDD practices.

Unit Testing Quiz
9 questions
Requirements
  • Basic JavaScript knowledge
  • A computer with an internet connection
Description

In this course you will learn the basics of the test driven development workflow and I will show you the best practices for using TDD. You will learn how to use Mocha, Chai and Sinon together to test your Javascript code giving you peace of mind that your code works as expected. After completing this course you will be able to extensively test your nodejs applications and websites. I will also show you each of the different styles for writing unit tests so that you can use the one that you like the best.


Alot of employers are starting to require TDD knowledge and so why not get started here?

Who this course is for:
  • Anyone looking to learn how to write unit tests for their code
  • Anyone who wants to start writing more reliable and robust code