This is a demo to show how to test React components with some extras.
Involved are React, Ant Design, Babel, Jest, Enzyme, webpack, some custom CSS, cats, and emoji 🐢.
Here comes the tricky part. These are some things you need to consider when testing with Jest:
- Jest automatically mocks your modules, you need to unmock them - and actually, they are stubbed
- Jest can use tools like webpack to preprocess files
Just install the Node modules:
npm i
ESlint is configured as a lint script in package.json
:
npm run lint
The test script in package.json
will run Jest using the default path __tests__
:
npm test
Components can be previewed via React Storybook. It will be available on (http://localhost:9900) if you run:
npm start
WTFPL (http://www.wtfpl.net/)