fix mock defaults

This commit is contained in:
2016-04-29 16:52:35 -07:00
parent 5d9fcd14b9
commit 683903512b

View File

@@ -10,7 +10,7 @@ function Client() {
this.transport = {}; this.transport = {};
} }
Client.prototype.index = function (params) { Client.prototype.index = function (params = {}) {
var shardCount = 2; var shardCount = 2;
return Promise.resolve({ return Promise.resolve({
_index: params.index || 'index', _index: params.index || 'index',
@@ -26,7 +26,7 @@ Client.prototype.ping = function () {
return Promise.resolve(); return Promise.resolve();
}; };
Client.prototype.get = function (params, source) { Client.prototype.get = function (params = {}, source = false) {
if (params === elasticsearch.errors.NotFound) return elasticsearch.errors.NotFound; if (params === elasticsearch.errors.NotFound) return elasticsearch.errors.NotFound;
const _source = source || { const _source = source || {
@@ -52,7 +52,7 @@ Client.prototype.get = function (params, source) {
}; };
}; };
Client.prototype.search = function (params, count = 5, source = {}) { Client.prototype.search = function (params = {}, count = 5, source = {}) {
const hits = times(count, () => { const hits = times(count, () => {
return { return {
_index: params.index || 'index', _index: params.index || 'index',
@@ -82,7 +82,7 @@ Client.prototype.search = function (params, count = 5, source = {}) {
}); });
}; };
Client.prototype.update = function (params) { Client.prototype.update = function (params = {}) {
var shardCount = 2; var shardCount = 2;
return Promise.resolve({ return Promise.resolve({
_index: params.index || 'index', _index: params.index || 'index',