Jest · Matcher
toHaveBeenCalledTimes
toHaveBeenCalledTimes(number) checks that a Jest mock function was called exactly the given number of times.
Last updated
Syntax
expect(mockFunction).toHaveBeenCalledTimes(number)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
expect(value)toHaveBeenCalled()toHaveBeenCalledWith(arg1, arg2, ...)toHaveBeenLastCalledWith(arg1, arg2, ...)jest.useFakeTimers()jest.runAllTimers()jest.runOnlyPendingTimers()jest.advanceTimersByTime(msToRun)