Skip to content

A sample project that demonstrates how to test mongoose operations through jest with an in-memory database.

Notifications You must be signed in to change notification settings

EOI-testing-2022/mongoose-inmemory

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Node.js + Mongoose + Jest sample project that demonstrates how to test mongoose operations using Jest with an in-memory database.

This repo was build as an example for my article Testing Node.js + Mongoose with an in-memory database.

Dependencies

What you need to run this project:

  • Node.js

(MongoDB is not required because it'll run in memory, handled by the package mongodb-memory-server).

Try it out

1. Install dependencies

npm install

2. Run tests

npm test

Contribute

Feel free to contribute to this project either by leaving your comments and suggestions in the Issues section or creating a PR. More and diverse test examples are always useful. Make sure to take a look at Jest docs and the existent examples to avoid repeating.

Tools

Main tools used in this project:

Also take a look at mongodb-memory-server-global to download mongod's binary globally and mongodb-memory-server-core if you'll run the test on a server that already has mongod installed.

About

A sample project that demonstrates how to test mongoose operations through jest with an in-memory database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%