¡Sorpréndeme!

How to create a stub for MongoDB using Sinon and Mocha

2024-08-07 2 Dailymotion

I have a registration method used for users registration. I need to test this method for correct working with a test framework but it will save a new user in the database at each test. So, how to test the method and avoid user saving? For this purpose I'm using the Sinon library to create a stub and then using Mocha to test the sub.