Slight refactor to the api module, so it will simply extend the client like it did
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
var es = require('../../src/elasticsearch'),
|
||||
api = require('../../src/lib/utils').requireDir(module, '../../src/api'),
|
||||
api = require('../../src/lib/api'),
|
||||
expect = require('expect.js');
|
||||
|
||||
describe('Client instances creation', function () {
|
||||
@ -10,7 +10,7 @@ describe('Client instances creation', function () {
|
||||
});
|
||||
|
||||
it('inherits the api', function () {
|
||||
client.bulk.should.be.exactly(api.bulk);
|
||||
client.cluster.nodeStats.should.be.exactly(api.cluster.node_stats);
|
||||
client.bulk.should.eql(api.bulk);
|
||||
client.cluster.nodeStats.should.eql(api.cluster.prototype.nodeStats);
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
var es = require('../../src/elasticsearch'),
|
||||
sinon = require('sinon'),
|
||||
expect = require('expect.js');
|
||||
|
||||
describe('transport', function () {
|
||||
|
||||
describe('#sniff', function () {
|
||||
it('does a head request to "/"', function (done) {
|
||||
var c = new es.Client();
|
||||
// stub the tranports request method, arg 1 is a callback
|
||||
sinon.stub(c.transport, 'request').callsArgAsync(1);
|
||||
|
||||
c.transport.sniff(function (err, resp) {
|
||||
var spy = c.transport.request.getCall(0),
|
||||
params = spy.args[0];
|
||||
|
||||
params.should.have.type('object');
|
||||
params.should.have.property('path', '/_cluster/nodes');
|
||||
if (params.method) {
|
||||
params.should.be('GET');
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when sniffOnStart === true', function () {
|
||||
|
||||
describe('and the cluster is down', function () {
|
||||
before(function (done) {
|
||||
var c = new es.Client({
|
||||
sniffOnStart: true,
|
||||
hosts: [
|
||||
'intentionally-not-a-real-cluster.com:9200'
|
||||
]
|
||||
});
|
||||
c.on('sniff complete', done);
|
||||
});
|
||||
|
||||
it('should not have any connections in the connection pool', function () {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -114,25 +114,6 @@ describe('Utils', function () {
|
||||
});
|
||||
|
||||
|
||||
describe('Lodash Modifications', function () {
|
||||
|
||||
describe('#map', function () {
|
||||
it('returns an object when passed an object', function () {
|
||||
var out = _.map({a: 1, b: 2}, function (val) { return val * 2; });
|
||||
expect(out).to.eql({a: 2, b: 4});
|
||||
});
|
||||
|
||||
it('returns an array for anything else', function () {
|
||||
var std = _.map([1, 2, 3], function (val) { return val * 2; });
|
||||
expect(std)
|
||||
.to.be.a('array')
|
||||
.and.to.eql(_.map('123', function (val) { return val * 2; }));
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('String Transformers', function () {
|
||||
|
||||
describe('#camelCase', function () {
|
||||
Reference in New Issue
Block a user