Sha256: f938ab7af64b2afefb94a0d75fdf2d535bf09d10f5e2234d10cadfa88e10ea62

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

'use strict';

const MongocryptdManager = require('../lib/mongocryptdManager').MongocryptdManager;
const expect = require('chai').expect;

describe('MongocryptdManager', function () {
  it('should default to having spawnArgs of --idleShutdownTimeoutSecs=60', function () {
    const mcdm = new MongocryptdManager();
    expect(mcdm.spawnArgs).to.deep.equal(['--idleShutdownTimeoutSecs', 60]);
  });

  it('should concat --idleShutdownTimeoutSecs=60 to provided args', function () {
    const mcdm = new MongocryptdManager({ mongocryptdSpawnArgs: ['foo', 12] });
    expect(mcdm.spawnArgs).to.deep.equal(['foo', 12, '--idleShutdownTimeoutSecs', 60]);
  });

  it('should not override `idleShutdownTimeoutSecs` if the user sets it using `key value` form', function () {
    const mcdm = new MongocryptdManager({
      mongocryptdSpawnArgs: ['--idleShutdownTimeoutSecs', 12]
    });

    expect(mcdm.spawnArgs).to.deep.equal(['--idleShutdownTimeoutSecs', 12]);
  });

  it('should not override `idleShutdownTimeoutSecs` if the user sets it using `key=value` form', function () {
    const mcdm = new MongocryptdManager({
      mongocryptdSpawnArgs: ['--idleShutdownTimeoutSecs=12']
    });

    expect(mcdm.spawnArgs).to.deep.equal(['--idleShutdownTimeoutSecs=12']);
  });

  it('should support construction with options', function () {
    const mcdm = new MongocryptdManager({
      mongocryptdURI: 'some-uri',
      mongocryptdBypassSpawn: true,
      mongocryptdSpawnPath: 'some-spawn-path',
      mongocryptdSpawnArgs: ['--idleShutdownTimeoutSecs=12']
    });

    expect(mcdm).to.eql({
      uri: 'some-uri',
      bypassSpawn: true,
      spawnPath: 'some-spawn-path',
      spawnArgs: ['--idleShutdownTimeoutSecs=12']
    });
  });
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
libmongocrypt-helper-1.7.4.0.1002 ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js
libmongocrypt-helper-1.7.4.0.1001 ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js
libmongocrypt-helper-1.7.4.0.1000 ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js