Unit testing in JavaScript Part 6 - Red, Green, Refactor and Jest mocks

Опубликовано: 16 Февраль 2026
на канале: Fun Fun Function
25,630
723

😍 Support the show by becoming a Patreon
  / funfunfunction  

💛 Wallaby (Show sponsor)
Wallaby.js runs your JavaScript tests immediately as you type and displays execution results in your code editor. It is insanely fast, because it only executes tests affected by your code changes and runs tests in parallel. Let them know you came from us by using this link:
http://wallaby.funfunfunction.com

🔗 Watch this series from the start
   • Unit testing in JavaScript Part 1 - Why un...  

🔗 Discuss this video on the Fun Fun Forum
https://www.funfunforum.com/t/unit-te...

🔗 Code from the episode
https://github.com/mpj/unit-testing-s...

🔗 That cool inline evaluation plugin
https://quokkajs.com/

🔗 mpj on Twitter
  / mpjme  

🔗 The gear I use to produce the videos
   • Behind the Scenes - FunFunFunction #22  

🔗 Help translate the show to your language
http://www.youtube.com/timedtext_cs_p...

Today, we are continuing our journey on unit testing in JavaScript. In this episode we do some refactoring, and change our tests to use Jest mock helpers instead of our custom mocks written in vanilla JavaScript.