Skip to content
masterclass Buddy

Jest · Function

toHaveBeenCalled

toHaveBeenCalled checks that a Jest mock function was called at least once. Use related call matchers to check its count or arguments.

Last updated

Syntax

expect(mockFunction).toHaveBeenCalled()

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • toHaveBeenCalledTimes
  • toHaveBeenCalledWith
  • toHaveBeenLastCalledWith
  • mock.calls
  • expect.anything()
  • expect.objectContaining()

Source: Expect · Jest. Checked 2026-11-03.