-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toHaveBeenCalledExactlyOnceWith
expects an array of objects, when the object is passed as args
#645
Comments
This was working with 4.0.0? I'm thinking #633 broke this. |
This is working for me test('toHaveBeenCalledExactlyOnceWith with object', () => {
const mock = jest.fn();
mock({ foo: 'bar' });
expect(mock).toHaveBeenCalledExactlyOnceWith({ foo: 'bar' });
}); |
Do you have a simple example I can reproduce this with? |
I think the problem is with the error message. Here's an example of what I'm seeing: it('github issue', () => {
const mock = jest.fn();
mock('hello', 'world', '!');
expect(mock).toHaveBeenCalledExactlyOnceWith('hello', 'world');
}); This throws an error message (which is expected) that looks like this:
I would expect it to show all of the args it was called with (like
I think it's just the error message that's confusing, but @oleksandrva lmk if I'm wrong in that assumption. On a side note, |
I just ran into this too. It looks like it's asserting correctly (on the full I think it's because it calls I also like that the |
Note: here is the test which uses the related snapshot that shows this same issue.
the I'd like to see this test use more than 1 arg to highlight the logic (e.g. |
Any updates on this bug or the related PR? I think the PR should solve this |
Bug
package
version:4.0.1
node
version:18.16.1
npm
version:9.5.1
What you did:
After the update to version
4.0.1
tests that check the call of the components with params are failing with this kind of error:The text was updated successfully, but these errors were encountered: