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.
SubscribeRelated
toHaveBeenCalledTimestoHaveBeenCalledWithtoHaveBeenLastCalledWithmock.callsexpect.anything()expect.objectContaining()