Testing · Junior · Question 33 of 78

How do you make a mock return a value?

Explanation

mockReturnValueOnce sets the value for one call only, and mockImplementation(fn) replaces the whole body.

Further reading

Problem with a question

Testing · Junior · question 33

Test yourself

Take the Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz