toHaveBeenCalledOnceWith
ascdi opened this issue · 1 comments
ascdi commented
Bug
package
version: 3.2.3node
version: 16.17.1npm
(oryarn
) version: 8.15.0
What you did:
I used toHaveBeenCalledOnceWith
on a method with two arguments
What happened (please provide anything you think will help):
The toHaveBeenCalledOnceWith
only matches the first argument and ignored the second.
Reproduction repository (if possible):
You can use the documentation page sniplet and add this code. It will run a green test.
https://jest-extended.jestcommunity.dev/docs/matchers/mock/#tohavebeencalledoncewith
test('passes only if mock was called exactly once with the expected value', () => {
const mock = jest.fn();
expect(mock).not.toHaveBeenCalled();
mock('hello', 'peter');
expect(mock).toHaveBeenCalledOnceWith('hello', 'toni');
});
This should fail because the mock wasn't called with toni
but with peter
.
keeganwitt commented
This is a duplicate of #517 (which hasn't been released yet).