Jest · Matcher
toHaveBeenCalledWith
Checks that a Jest mock function was called with a specified list of arguments. It uses toEqual-style comparison for those arguments.
Last updated
Syntax
expect(mock).toHaveBeenCalledWith(arg1, arg2, ...)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
expecttoEqualtoHaveBeenLastCalledWithtoHaveBeenNthCalledWithexpect.anyexpect.objectContainingexpect.arrayContaining