Skip to content
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

Spy on insertMany calls #90

Open
cristian-moreno-ruiz opened this issue Mar 16, 2022 · 0 comments
Open

Spy on insertMany calls #90

cristian-moreno-ruiz opened this issue Mar 16, 2022 · 0 comments

Comments

@cristian-moreno-ruiz
Copy link

I want to spy on a call to insertMany, but I can't seem to find the proper way to do it. I currently do something similar for find and it seems to work fine. This is how my test looks like:

const findSpy = jest.fn().mockResolvedValue([]);
const insertManySpy = jest.fn();
mockingoose(accountModel).toReturn(findSpy, 'find');
mockingoose(accountModel).toReturn(insertManySpy, 'insertMany');

I can manage to access the conditions of the find queries like this findSpy.mock.calls[0][0]._conditions.

However, I've not been able to check through the documents to be inserted using the insertManySpy. Anyone knows how can I do this?

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

No branches or pull requests

1 participant