Testing · Junior · Question 75 of 78

Why doesn't this test catch a bug?

test("saves", () => {
  save(data).then((result) => {
    expect(result.ok).toBe(true);
  });
});

Explanation

Add return or make the test async and await the promise.

Further reading

Problem with a question

Testing · Junior · question 75

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