Testing · Middle · Question 14 of 75

What does mockImplementationOnce allow?

fetchUser
  .mockRejectedValueOnce(new Error("timeout"))
  .mockResolvedValueOnce({ name: "Ann" });

Explanation

After the “once” values run out, the default implementation (if any) is used.

Further reading

Problem with a question

Testing · Middle · question 14

Test yourself

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

Take this quiz