Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

value '...actual' is not correct for toHaveBeenCalledExactlyOnceWith fail case #672

Open
lcialon opened this issue Nov 13, 2023 · 2 comments · May be fixed by #675
Open

value '...actual' is not correct for toHaveBeenCalledExactlyOnceWith fail case #672

lcialon opened this issue Nov 13, 2023 · 2 comments · May be fixed by #675

Comments

@lcialon
Copy link

lcialon commented Nov 13, 2023

test('jest mock', () => {
    const mock = jest.fn();
    mock('hello', 1);
    expect(mock).toHaveBeenCalledExactlyOnceWith('hello', 3);
  }

Output:

expect(received).toHaveBeenCalledExactlyOnceWith(expected)
Expected mock function to have been called exactly once with ["hello", 3], but it was called with "hello"

Should be something like:

Expected mock function to have been called exactly once with ["hello", 3], but it was called with "hello", 1

OR even better:

Expected mock function to have been called exactly once with ["hello", 3], but it was called with ["hello", 1]
@forivall forivall linked a pull request Jan 26, 2024 that will close this issue
4 tasks
@alopix
Copy link

alopix commented Apr 3, 2024

Have been running into the same issue a few times lately. Any idea if #675 will be merged to fix this?

@forivall
Copy link

forivall commented Oct 8, 2024

I've just been manually switching to toHaveBeenCalledWith when there's a test failure as my workaround... Obviously, i'm also waiting for that PR to be merged 😉

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants