Reference
Notes
How to set up Jest using WebPack:
https://jestjs.io/docs/getting-started
Introduction to jest-DOM
jest-dom
is a companion library for Testing Library that provides custom DOM element matchers for Jest
npm install --save-dev @testing-library/jest-dom
Example of Using JEST
// sum.js
function sum(a, b) {
return a + b;
}
module.exports = sum;
// sum.test.js
const sum = require('./sum');
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});
npm test