Testing verifies that your code works as expected. Unit tests check individual functions in isolation using assertions like expect(actual).toBe(expected).
function add(a, b) { return a + b; }
describe('add function', () => {
it('adds two positive numbers', () => {
expect(add(2, 3)).toBe(5);
});
// ...Add a third test case for the add function, then run the test suite.
Testing verifies that your code works as expected. Unit tests check individual functions in isolation using assertions like expect(actual).toBe(expected).
function add(a, b) { return a + b; }
describe('add function', () => {
it('adds two positive numbers', () => {
expect(add(2, 3)).toBe(5);
});
// ...Add a third test case for the add function, then run the test suite.