
ReactJS
Jest is a zero-config testing framework for JavaScript and React.
// sum.test.js
test('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});describe('Calculator', () => {
test('adds numbers', () => {
expect(add(1, 2)).toBe(3);
});
test('subtracts numbers', () => {
expect(subtract(5, 3)).toBe(2);
});
});expect(value).toBe(5); // Exact match
expect(value).toEqual({ a: 1 }); // Deep equality
expect(value).toBeTruthy(); // Truthy
expect(value).toContain(2); // Array contains
expect(text).toMatch(/jest/i); // Regex matchnpm test # Run all tests
npm test -- --coverage # With coverage
npm test -- --watch # Watch modeResources
Ojasa Mirai
Master AI-powered development skills through structured learning, real projects, and verified credentials. Whether you're upskilling your team or launching your career, we deliver the skills companies actually need.
Learn Deep โข Build Real โข Verify Skills โข Launch Forward