Advanced Mongo Mongoose - andrewkyllo-401-advanced-javascript/seattle-javascript-401d34 GitHub Wiki
Testing Node.js & Mongoose with an in-memory database
IN-memory database pros & cons
Pros
- No need for mocks as code is executed directly
- Faster development
- More reliable tests as you are testing the actual code
- Tests are easier to build
Cons
- The in-memory database probably needs seeding
- More memory usage
- Test take longer to run
Repository Design Pattern
The separation of data access from business logic have many benefits
- Centralization of the data access logic makes code easier to maintain
- Business and data access logic can be tested separately
- Reduces duplication of code
- A lower chance of making programming errors
Flexibility through Repositories
- A repository is an interface between two things