jest

Testing vanilla JavaScript with Jest

If you want to learn how to write javascript tests with jest, this book is for you. In this book, you’ll find real-world examples of jest testing, such as testing JQuery event/selector, localStorage, IntersectionObserver, timer,…

Advanced Sinon tutorial- Mocks, Spies & Stubs

This post will show you how to stub window/document properties like getElementById and custom functions. Let’s understand this with an example. Consider the following javascript code. In this code, I am getting the div and se…

Testing DOM using JSDOM in sinon/mocha

I’ll show you how to use JSDOM in your frontend testing in this article. When you run a unit test in node.js, you’ll notice that the document or window object isn’t accessible. As a result, testing it is extremely difficult…

Mocking- A guide to mock jQuery ajax using Jest

This is my personal favourite tip from the collection. In almost every project, we used an ajax call. Ajax testing is difficult because it is dependent on an external source. In this example, I’ll show you how to use jest to tes…

Testing with Jest: Awesome Tips and Tricks

In this blog post I will discuss some tips and trics about the JEST framework. Jest Internally used JSDOM . ** JSDOM** is a library which parses and interacts with assembled HTML just like a browser. The benefit to JSDO…

How to mock DOM element in Javascript/JQuery using Jest

Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, No…

Mocking Specific module functions in JEST

Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, No…

Testing JavaScript Event Listeners with Jest

Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, Nod…

How to mock jQuery calls with Jest with real world example

Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, No…

Load More
That is All