'toHaveBeenCalledOnceWith' error message doesn't handle mismatched argument lengths
SLKnutson opened this issue · 1 comments
SLKnutson commented
Bug
package
version: 3.2.4node
version: 18.14.0npm
(oryarn
) version: 9.4.2
Relevant code or config
it('bad messaging', () => {
const obj = {doSomething: (someString, someOtherString) => {}};
const doSomethingSpy = jest.spyOn(obj, 'doSomething');
obj.doSomething('hi', 'bye');
expect(doSomethingSpy).toHaveBeenCalledOnceWith('hi');
});
Run test. The error message will be
Expected mock function to have been called exactly once with ["hi"], but it was called with:
"hi"
I would expect it to list the missing expected parameter, like it does for toHaveBeenCalledWith
Expected: "hi"
Received: "hi", "bye"
Thanks!
keeganwitt commented
I think this will be fixed with #572