Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write tests for database operations and its functions #21

Closed
powilliam opened this issue Apr 29, 2020 · 6 comments
Closed

Write tests for database operations and its functions #21

powilliam opened this issue Apr 29, 2020 · 6 comments

Comments

@powilliam
Copy link
Contributor

To avoid the necessity of have mongod locally installed or use its cloud services i pretend to use an implementation of MongoDB for memory storage.

@EduardoAraujoB
Copy link
Collaborator

Create a mock for the database is a great option to test it

@HenriqueDerosa
Copy link

Is it worth to use a testing database version to do real tests for database operations?
Or is it enough to test with mock. If it is database operations, we might need a database, right? 🤷🏻‍♂️

@EduardoAraujoB
Copy link
Collaborator

Maybe define a SQLite database for tests is a great option, but we will have problems beacuse the test for database operations will be assyncronous

@powilliam
Copy link
Contributor Author

That's why i'm using MongoDB Memory Server. It uses the latest mongod binary located onnode_modules/.cache/mongodb-binaries to setup a MongoDB memory database. jest-mongodb uses it under the hood. By this way we don't have to setup a real database.

@HenriqueDerosa
Copy link

To test, we could just create a local database with Mongo Article: setup a local MongoDB Connection

@powilliam
Copy link
Contributor Author

powilliam commented Apr 30, 2020

Closing due to #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants