Installation and Jest setup Refer to https://jestjs.io/docs/getting-started Matchers Full list of matchers: https://jestjs.io/docs/expect Matching exact equality with toBe Matching value equality with toEqual Matching opposites with not Matching truthiness, null, undefined and defined Matching numbers Matching floating point numbers Matching strings using regular expression with toMatch Matching arrays and iterables with toContain Matching exceptions with […]

Types of tests Unit Tests test very specific, low-level pieces of functionality for example if a function returns the expected value. Integration Tests ensure that the individual pieces of your application work together correctly. For example if a method invocation successfully calls an API which in turn stores a value in the database. Single-service integration […]

This article will demonstrate how to test JavaScript files in NodeJS using the libraries Sinon, Mocha and Chai. Sinon is often installed together with Mocha and Chai, but it is not required.

Setup Fakes, spies and stubs are created in the default sandbox which needs to be restored after each test to prevent memory leaks. We use a Mocha hook plugin for that: Types of test doubles Type What it does Behavior Pre-programmed behavior Pre-programmed expectations When to use Fake records arguments, return value, the value of […]

What you can do with Cypress Cypress features Important Cypress concepts Cypress vs. Selenium vs. WebDriver Selenium and most other testing tools run outside of the browser and execute remote commands across the network. Cypress does the opposite as it is executed in the same run loop as the application. Behind Cypress is a Node server […]

We are going to have a look at how you can test your React Components and your Redux reducers and actions.