From b2781a6ccfdc4a4f80bb76dcbb72f64afd57de5c Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Fri, 29 Apr 2016 17:52:24 -0700 Subject: [PATCH] client.get: mix in source data, fix default index and type params --- test/fixtures/elasticsearch.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/fixtures/elasticsearch.js b/test/fixtures/elasticsearch.js index 97805a0..620bb00 100644 --- a/test/fixtures/elasticsearch.js +++ b/test/fixtures/elasticsearch.js @@ -26,10 +26,10 @@ Client.prototype.ping = function () { return Promise.resolve(); }; -Client.prototype.get = function (params = {}, source = false) { +Client.prototype.get = function (params = {}, source = {}) { if (params === elasticsearch.errors.NotFound) return elasticsearch.errors.NotFound; - const _source = source || { + const _source = Object.assign({ payload: { id: 'sample-job-1', now: 'Mon Apr 25 2016 14:13:04 GMT-0700 (MST)' @@ -40,11 +40,11 @@ Client.prototype.get = function (params = {}, source = false) { attempts: 0, max_attempts: 3, status: 'pending' - }; + }, source); return { - _index: params.index, - _type: params.type, + _index: params.index || 'index', + _type: params.type || 'type', _id: params.id || 'AVRPRLnlp7Ur1SZXfT-T', _version: params.version || 1, found: true,