How to mock database operations in API calls using jest?

Viewed 19

I've an API, It performs other operations and in the end it does database operations like creation or updation. I need to test that API using JEST and SUPERTEST, but when I test that API it makes changes in the database and I don't want that to happen, I need to mock that database operation using JEST. I want to test that API using JEST but should not affect the database. How can I able to achieve this? I couldn't find any good examples in the internet. Somebody help me to test it.

0 Answers
Related