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

Error simulation with Model.create doesn't work with the 'save' operation #105

Open
barnisanov opened this issue Jul 25, 2023 · 0 comments

Comments

@barnisanov
Copy link

(I'm using version 2.16.2)
When I try to simulate an error on any save(Model.save()/Model.create()/doc.save()), the plain 'save' operation doesn't cover the Model.create(), but when I simulate it for both the 'save' and '$save' operations it works:
const expectedError = new Error('Not supposed to save');
mockingoose(MyModel).toReturn(expectedError, '$save');
mockingoose(MyModel).toReturn(expectedError, 'save');

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