JavaScript | Testing And Optimization | Question 10

Last Updated :
Discuss
Comments

What does the following Jest test case do?

JavaScript
test('adds 1 + 2 to equal 3', () => {
    expect(1 + 2).toBe(3);
});


Logs the result of the addition

Throws an error if the result is not 3

Mocks the addition function

Asserts that the sum of 1 and 2 equals 3

Share your thoughts in the comments