question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot pass mock as parameter for toBeCalledWith

See original GitHub issue

When I call toBeCalledWith passing another mock as parameter an error occurs.

Sample code:

expect(myMock.sampleMethod).toBeCalledWith(otherMock);

Error:

TypeError: Result of the Symbol.iterator method is not an object

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
marchaoscommented, Jun 12, 2020

Yep, released as of now so give it a go.

On Fri, 12 Jun 2020, 09:23 asnaseer-resilient, notifications@github.com wrote:

I assume this will be published as v1.0.9 - is there any eta on this?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/marchaos/jest-mock-extended/issues/28#issuecomment-643143336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVBY6IMW65SGAUEEEWWYX3RWHQZTANCNFSM4MGFI5LA .

0reactions
asnaseer-resilientcommented, Jun 12, 2020

I assume this will be published as v1.0.9 - is there any eta on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest passing an object to expect().toBeCalledWith()
The problem is I want to test a function that takes object as a parameter so when you call expect(myFunc).toBeCalledWith(object); the test ...
Read more >
Mock Functions or Spies Demystified - How Does jest.fn() Work?
You can pass them as arguments to other functions, they can be assigned as properties of objects (as methods), or you can return...
Read more >
Cannot validate mock of method with out parameter received ...
in the above code I'm trying to validate that the mock received a call to a method that has an out parameter defined....
Read more >
Mock Functions - Jest
Mock functions allow you to test the links between code by erasing the actual implementation of a function, capturing calls to the function ......
Read more >
API Reference | Vitest
This assertion checks if a function was called with certain parameters at it's last invocation. Requires a spy function to be passed to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found