Sign in
Log inSign up
I want to test my ExpressJS controller code. How do I test the database calls?

I want to test my ExpressJS controller code. How do I test the database calls?

Lisa Stroupe's photo
Lisa Stroupe
·Jan 11, 2016

I am using MongoDB as database and mongoose as the ODM. I want to test my controller code but don't want to use the database for testing, how can I mock the database and database calls? How do you generally test your controller code.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct