22 / 06 / 2022

29. Testing

Today, I would like to share more on testing. I have started using Jest and Enzyme to do simple tests on my blog. These two are one of the most popular tools in doing testing web development. Although they are different but they are complimentary tools, that can integrate well together to provide flexible and creative testing abilities. Jest is a JavaScript unit testing framework, used by Facebook to test services and React applications. It provides Snapshot testing, that is to create a rendered ‘snapshot’ of a component and compare it to a previously saved ‘snapshot’. The test will fail if the two do not match. While Enzyme is a JavaScript testing utility for React that makes it easier to assert, manipulate, and traverse your React Components’ output. For example, it would render a component (or multiple components), find elements, or interact with elements.

I have tried set up the jest config and have written some tests to test the components on my blog.