How to use the mongodb-memory-server.MongoMemoryReplSet function in mongodb-memory-server

To help you get started, we’ve selected a few mongodb-memory-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scality / Arsenal / tests / functional / metadata / mongodb / mongoClientInterface.js View on Github external
const { MongoMemoryReplSet } = require('mongodb-memory-server');

const errors = require('../../../../lib/errors');
const logger = new werelogs.Logger('MongoClientInterface', 'debug', 'debug');
const BucketInfo = require('../../../../lib/models/BucketInfo');
const ObjectMD = require('../../../../lib/models/ObjectMD');
const MongoClientInterface =
    require('../../../../lib/storage/metadata/mongoclient/MongoClientInterface');
const MetadataWrapper =
    require('../../../../lib/storage/metadata/MetadataWrapper');

const implName = 'mongodb';
const dbName = 'metadata';
const bucketName = 'testbucket';

const mongoserver = new MongoMemoryReplSet({
    debug: false,
    instanceOpts: [
        { port: 27018 },
    ],
    replSet: {
        name: 'rs0',
        count: 1,
        dbName,
        storageEngine: 'ephemeralForTest',
    },
});

describe('MongoClientInterface', () => {
    let metadata;
    before(done => {
        mongoserver.waitUntilRunning().then(() => {

mongodb-memory-server

MongoDB Server for testing (auto-download latest version). The server will allow you to connect your favourite ODM or client library to the MongoDB Server and run parallel integration tests isolated from each other.

MIT
Latest version published 2 months ago

Package Health Score

98 / 100
Full package analysis