added notes to the API docs regarding the two API versions, and a warning to the config docs. Also updated the client tests to work with the new default
This commit is contained in:
@ -1,32 +1,37 @@
|
||||
describe('Client instances creation', function () {
|
||||
var es = require('../../src/elasticsearch');
|
||||
var api = require('../../src/lib/api');
|
||||
var api090 = require('../../src/lib/api_0_90');
|
||||
var expect = require('expect.js');
|
||||
var client;
|
||||
|
||||
beforeEach(function () {
|
||||
if (client) {
|
||||
client.close();
|
||||
}
|
||||
client = new es.Client();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
client.close();
|
||||
});
|
||||
|
||||
it('throws an error linking to the es module when you try to instanciate the exports', function () {
|
||||
var Es = es;
|
||||
expect(function () {
|
||||
var client = new Es();
|
||||
var c = new Es();
|
||||
}).to.throwError(/previous "elasticsearch" module/);
|
||||
});
|
||||
|
||||
it('Succeeds even not called with new', function () {
|
||||
var client = es.Client();
|
||||
expect(client.bulk).to.eql(api.bulk);
|
||||
expect(client.cluster.nodeStats).to.eql(api.cluster.prototype.nodeStats);
|
||||
it('inherits the 0.90 API by default', function () {
|
||||
expect(client.bulk).to.eql(api090.bulk);
|
||||
expect(client.cluster.nodeStats).to.eql(api090.cluster.prototype.nodeStats);
|
||||
});
|
||||
|
||||
it('inherits the api', function () {
|
||||
it('inherits the master API when specified', function () {
|
||||
client.close();
|
||||
client = es.Client({
|
||||
apiVersion: 'master'
|
||||
});
|
||||
expect(client.bulk).to.eql(api.bulk);
|
||||
expect(client.cluster.nodeStats).to.eql(api.cluster.prototype.nodeStats);
|
||||
expect(client.nodes.stats).to.eql(api.nodes.prototype.stats);
|
||||
});
|
||||
|
||||
it('closing the client causes it\'s transport to be closed', function () {
|
||||
|
||||
Reference in New Issue
Block a user