1.0.4 • Published 4 years ago
mongolithic v1.0.4
mongolithic
A simple node module to test your mongo unit tests
First Steps
The mongolithic was develop to help you to test your route disconnect from a real MongoDb database.
Installing the library
$ npm install mongolithic
Referencing the library in your code
$ const { MongoClient } = require('mongolithic')
Now, you can connect to your database with the same arguments that you use to connect a real MongoDb.
$ const client = await MongoClient.connect(url,options)
or
* const url = [
{id:1, description:'test-1'},
{id:2, description:'test-2'}]
* const options = {option:{id:1}} (example)
$ return MongoClient.connect(url,options)
The connection will accept the two params url and options. The url param will receive a array structure where it will be used like your response and will call find methods.
Now, your are able to test your Mongo disconnected.