DEV Community

Discussion on: Need recommendations in Mocking database / Testing Cleanup (Unit Testing)

orkon profile image
Alex Rudenko

For such API level tests, I usually use a real database instance running locally, and I clean up the entire database before every test and insert objects required for a test case using the models (in this case, it would be mongoose models). Pros: it gives more confidence that things run fine. Cons: 1) the time needed to run tests increases. 2) you need to set-up a test DB