Pain Free Mocking with Jest

Learn to confidently test JavaScript applications and mock dependencies using Jest, the pain-free way.

Understand how to painlessly use Mocks, Spies, and Stubs to test any part of your application, without worrying about Databases, APIs and Security Tokens.

After finishing this course (which only takes a single afternoon), you'll feel confident in your testing skills because you'll have all the knowledge and tools you need to effectively and painlessly test even complex applications in the real world without headaches.

  • 4.4 / 5 (10 ratings)
  • Published
  • Updated
On demand video

2 hrs 36 mins

Video Lessons

39 Videos

Course Instructor
Avatar Image

Akinwale Folorunsho Habibullah

I'm Akinwale Habib. I am a senior software engineer and a former bootcamp instructor at Andela. I have led technical teams to develop eHealth products at Savics, and also helped many aspiring software engineers learn the proper way to write applications using Agile methodologies and TDD.

How The Course Works

01Remote

You can take the course from anywhere in the world, as long as you have a computer and an internet connection.

02Self-Paced

Learn at your own pace, whenever it's convenient for you. With no rigid schedule to worry about, you can take the course on your own terms.

03Community

Join a vibrant community of other students who are also learning with Pain Free Mocking with Jest. Ask questions, get feedback and collaborate with others to take your skills to the next level.

04Structured

Learn in a cohesive fashion that's easy to follow. With a clear progression from basic principles to advanced techniques, you'll grow stronger and more skilled with each module.

Course Preview

What You Will Build In This Course

Course Overview

What you will learn
  • How to write unit and integration tests with Jest

  • How to test functions that interact with Controllers, APIs, and Databases (without relying on their responses)

  • How to test code in isolation with Mocks, Spies, and Stubs using Mockingoose

  • How to write integration tests for HTTP endpoints and database connections

  • Advanced mocking and integration testing techniques like the 3A pattern, network manipulation, and more

  • How to become a test strategist with the Agile Testing Quadrant, create CI test pipelines, and add tests to the development lifecycle

The Issue With Unit Testing & Mocks

Writing unit tests has always been equal parts important and confusing.

While writing your first unit test is simple and easy, the learning curve becomes very steep very quickly once you have to test actual real-life scenarios.

Because suddenly, you have to know how to mock a database call or spy an HTTP request or stub a 3rd party API with a security token. When you have to test real-life scenarios like that, things become much more complex than they initially seemed.

With every test case being different from the next one, and with Mocks not being used anywhere else in coding except for testing, it's hard to find quality information online. Every answer is different from the next one and is aimed for an ultra-specific scenario that won't necessarily apply to any other case, including yours.

Instead of making things clear, this confuses things even further.

How "Pain Free Mocking with Jest" Helps:

"Pain Free Mocking with Jest" is designed to make testing painless by helping you understand once and for all the 'How', 'What', and 'When' of Mocks, Spies, and Stubs using the Jest testing framework.

You will learn how to write simple and complex test cases, utilize Jest's mocking capabilities, and gain hands-on experience with real-world testing scenarios that involve Databases, HTTP requests, and 3rd Party APIs.

By the end of the course, you'll feel confident using Mocks, Spies and Stubs in any scenario you may need them. You'll have all the knowledge and tools you need to create complete test suites and confidently test JavaScript applications with mocking without headaches.

Course Content Overview

Course Overview: Total Modules: 6 Total Lessons: 37 Total Video Runtime: 2 hours, 28 minutes

Summary:

  • Build and test a Node.js REST API application with authentication features like 'Sign Up' and 'Sign In'.
  • Learn how to test everything from simple functions all the way to Controllers that interract with 3rd party web services.
  • Learn the 'What', 'How', and 'When' of Mocks, Spies, and Stubs.
  • Learn to see your application code in testable units.
  • Write integration tests for HTTP endpoints, controllers, middleware functions, and 3rd party integrations.
  • Create Git hooks to run unit tests before each commit
  • Build a CI pipeline using Github Actions to automate running integration tests on each git push to Github.

Our students work at

  • salesforce-seeklogo.com.svgintuit-seeklogo.com.svgAdobe.svgDisney.svgheroku-seeklogo.com.svgAT_and_T.svgvmware-seeklogo.com.svgmicrosoft-seeklogo.com.svgamazon-seeklogo.com.svg
sample bg image url

Sample Course Lessons

Course Syllabus and Content

Pain Free Mocking with Jest teaches you how to effectively and painlessly test JavaScript applications with Jest. You'll start by learning how to write unit and integration tests as well as the 'How', 'What', and 'When' of Mocks, Stubs, and Spies. Then we'll move to more advanced technique and strategies you'll be using for the rest of your career, including how to have a hollistic approach to testing and how to automatically add your tests in the development lifecycle.

Module 1

Introduction

6 Lessons 20 Minutes

Everything you need to know to start testing with Jest. You'll set up your environment, learn how to think like a tester with the Testing Pyramid and you'll even write your first test!

Module 2

Getting started with mocking and unit testing

13 Lessons1 Hours 2 Minutes

Get started with unit testing and mocking. Write more unit tests, learn how, when, and why to use mocks, stubs, and spies, mock databases and participate in some fun testing exercises.