loading...

re: Testing Node.js + Mongoose with an in-memory database VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I want your help I have applied this procedure on MongoDB locally but I don't find data in the database though I have to remove clean database fu...
 

Hi there!
The code I provided in this article clears out the database after every test. If that's not what you want, you can delete the contents of the afterEach function to avoid losing your data after every test.
However, keep in mind that if you're using mongodb-memory-server as your test database, every time you run the tests the database is created from scratch, so you'll have to populate any test data you need before running the tests (I'd do it in the beforeAll function, for example).
Hope this helps!

code of conduct - report abuse