Skip to content
RED SAGSkills
medium10 pts · first answer countstest-automationjestunit-testing

A test that passes for the wrong reason

This test passes even when fetchUser rejects. Why, and what is a fix?

test('loads user', () => {
  fetchUser(7).then((user) => {
    expect(user.name).toBe('Asha')
  })
})
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions