get the unit tests to pass
This commit is contained in:
@ -68,7 +68,7 @@ describe('Client Action runner', function () {
|
||||
afterEach(function () { _stash = {}; });
|
||||
var make = function (params) {
|
||||
_stash.orig = params;
|
||||
_stash.copy = _.clone(params);
|
||||
_stash.copy = _v4.clone(params);
|
||||
return params;
|
||||
};
|
||||
make.check = function () {
|
||||
|
||||
@ -175,10 +175,10 @@ describe('Connection Pool', function () {
|
||||
new ConnectionAbstract(new Host('http://localhost:9202')),
|
||||
new ConnectionAbstract(new Host('http://localhost:9203'))
|
||||
];
|
||||
var pingQueue = _.shuffle(connections);
|
||||
var pingQueue = _v4.shuffle(connections);
|
||||
var expectedSelection = pingQueue[pingQueue.length - 1];
|
||||
|
||||
_.each(pingQueue, function (conn) {
|
||||
_v4.each(pingQueue, function (conn) {
|
||||
pool.addConnection(conn);
|
||||
stub(conn, 'ping', function (params, cb) {
|
||||
if (typeof params === 'function') {
|
||||
|
||||
@ -2,7 +2,7 @@ var errors = require('../../../src/lib/errors');
|
||||
var expect = require('expect.js');
|
||||
var _ = require('lodash-migrate');
|
||||
|
||||
_.each(errors, function (CustomError, name) {
|
||||
_v4.each(errors, function (CustomError, name) {
|
||||
if (name.charAt(0) !== '_') {
|
||||
describe(name, function () {
|
||||
it('extend the ErrorAbstract and Error classes', function () {
|
||||
|
||||
@ -3,7 +3,6 @@ describe('File Logger', function () {
|
||||
var FileLogger = require('../../../src/lib/loggers/file');
|
||||
var once = require('events').EventEmitter.prototype.once;
|
||||
var _ = require('../../../src/lib/utils');
|
||||
var _v4 = require('lodash-migrate/lodash');
|
||||
var parentLog;
|
||||
var logger;
|
||||
var expect = require('expect.js');
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
describe('Random Selector', function () {
|
||||
var randomSelector = require('../../../src/lib/selectors/random');
|
||||
var _ = require('lodash-migrate');
|
||||
var _v4 = require('lodash-migrate/lodash');
|
||||
var expect = require('expect.js');
|
||||
|
||||
it('chooses a selection by random', function () {
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
describe('Round Robin Selector', function () {
|
||||
var selector = require('../../../src/lib/selectors/round_robin');
|
||||
var _ = require('lodash-migrate');
|
||||
var _v4 = require('lodash-migrate/lodash');
|
||||
var expect = require('expect.js');
|
||||
|
||||
it('chooses options in order', function () {
|
||||
var options = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
||||
var expected = _.clone(options);
|
||||
var expected = _v4.clone(options);
|
||||
var selections = [];
|
||||
|
||||
_v4.times(options.length, function () {
|
||||
|
||||
@ -5,7 +5,6 @@ describe('Stream Logger', function () {
|
||||
var once = require('events').EventEmitter.prototype.once;
|
||||
var stream = new MockWritableStream();
|
||||
var _ = require('../../../src/lib/utils');
|
||||
var _v4 = require('lodash-migrate/lodash');
|
||||
var expect = require('expect.js');
|
||||
var parentLog;
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ var errors = require('../../../src/lib/errors');
|
||||
var sinon = require('sinon');
|
||||
var expect = require('expect.js');
|
||||
var _ = require('lodash-migrate');
|
||||
var _v4 = require('lodash-migrate/lodash');
|
||||
var nodeList = require('../../fixtures/short_node_list.json');
|
||||
var stub = require('../../utils/auto_release_stub').make();
|
||||
|
||||
@ -288,23 +287,23 @@ describe('Transport Class', function () {
|
||||
it('calls _.shuffle be default', function () {
|
||||
var _ = require('../../../src/lib/utils');
|
||||
stub(Transport.connectionPools.main.prototype, 'setHosts');
|
||||
stub(_, 'shuffle');
|
||||
stub(_v4, 'shuffle');
|
||||
var trans = new Transport({
|
||||
hosts: 'localhost'
|
||||
});
|
||||
|
||||
expect(_.shuffle.callCount).to.eql(1);
|
||||
expect(_v4.shuffle.callCount).to.eql(1);
|
||||
});
|
||||
it('skips the call to _.shuffle when false', function () {
|
||||
var _ = require('../../../src/lib/utils');
|
||||
stub(Transport.connectionPools.main.prototype, 'setHosts');
|
||||
stub(_, 'shuffle');
|
||||
stub(_v4, 'shuffle');
|
||||
var trans = new Transport({
|
||||
hosts: 'localhost',
|
||||
randomizeHosts: false
|
||||
});
|
||||
|
||||
expect(_.shuffle.callCount).to.eql(0);
|
||||
expect(_v4.shuffle.callCount).to.eql(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -619,7 +618,7 @@ describe('Transport Class', function () {
|
||||
|
||||
// trigger a select so that we can harvest the connection list
|
||||
trans.connectionPool.select(_.noop);
|
||||
_.each(connections, function (conn) {
|
||||
_v4.each(connections, function (conn) {
|
||||
stub(conn, 'request', failRequest);
|
||||
});
|
||||
|
||||
@ -763,7 +762,7 @@ describe('Transport Class', function () {
|
||||
prom.then(_.noop, _.noop);
|
||||
|
||||
expect(_.size(clock.timers)).to.eql(1);
|
||||
_.each(clock.timers, function (timer, id) {
|
||||
_v4.each(clock.timers, function (timer, id) {
|
||||
expect(timer.callAt).to.eql(30000);
|
||||
clearTimeout(id);
|
||||
});
|
||||
@ -780,14 +779,14 @@ describe('Transport Class', function () {
|
||||
prom.then(_.noop, _.noop);
|
||||
|
||||
expect(_.size(clock.timers)).to.eql(1);
|
||||
_.each(clock.timers, function (timer, id) {
|
||||
_v4.each(clock.timers, function (timer, id) {
|
||||
expect(timer.callAt).to.eql(5000);
|
||||
clearTimeout(id);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
_.each([false, 0, null], function (falsy) {
|
||||
_v4.each([false, 0, null], function (falsy) {
|
||||
it('skips the timeout when it is ' + falsy, function () {
|
||||
var clock = sinon.useFakeTimers();
|
||||
stub.autoRelease(clock);
|
||||
|
||||
Reference in New Issue
Block a user