1.0.0 • Published 2 years ago

@andre.freitas/mongolithic v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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.

1.0.0

2 years ago