Skip to content

tested app unable to connect to mock db #155

Open
@chengtangzheng2021

Description

@chengtangzheng2021

The line of process.env.MONGO_URL = uri; passing connection string to the tested app, in the below connection code, but the app using this connection url get connection refused.

const connect = async () => {
var mongodb = require('mongo-mock');
var uri = 'mongodb://localhost:27017/myproject';
process.env.MONGO_URL = uri;
process.env.MDB_NAME = 'PricerDB_EMEA';
var MongoClient = mongodb.MongoClient;
MongoClient.connect(url, {}, function (err, client) {
db = client.db();
var collection = db.collection('adjustmentsDetails');
collection.insertOne({ "startOn": new Date("2020-07-10 15:00:00.000") })
})
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions