.toHaveBeenCalledTimes()

This assertion checks that a mock was called.

const mock = jest.fn();
 
mock();
 
jestUnexpected(mock).toHaveBeenCalledTimes(2);
expected
function proxy() {
  return p.invoke(func, this, slice.call(arguments));
}
was called times 2
  
expected
[
  
{
  
proxyfunction proxy() {
  return p.invoke(func, this, slice.call(arguments));
},
thisValueundefinedargs: [], returnValueundefined,
exceptionundefinedcallId1errorWithCallStackundefined
}
]
to have length 2
  
expected 1 to be 2