Jest

Jest is used by Facebook to test all JavaScript code including React applications. One of Jest’s philosophies is to provide an integrated “zero-configuration” experience. We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in more stable and healthy code bases.

How to mock a function

(Very usefull when you are passing props to component which need dispatch)

1
const mockedFunc = jest.fn()

Preparing eslint for jest

1
npm i --save-dev eslint-plugin-jest

Then add jest to your .eslintrc list of plugins

Utils

Comments

⬆︎TOP