fix inconcistent constants use
This commit is contained in:
10
test/fixtures/elasticsearch.js
vendored
10
test/fixtures/elasticsearch.js
vendored
@@ -1,6 +1,6 @@
|
|||||||
import { uniqueId, times, random } from 'lodash';
|
import { uniqueId, times, random } from 'lodash';
|
||||||
import elasticsearch from 'elasticsearch';
|
import elasticsearch from 'elasticsearch';
|
||||||
import { DEFAULT_SETTING_DOCTYPE } from '../../lib/helpers/constants';
|
import constants from '../../lib/helpers/constants';
|
||||||
|
|
||||||
function Client() {
|
function Client() {
|
||||||
this.indices = {
|
this.indices = {
|
||||||
@@ -15,7 +15,7 @@ Client.prototype.index = function (params = {}) {
|
|||||||
const shardCount = 2;
|
const shardCount = 2;
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
_index: params.index || 'index',
|
_index: params.index || 'index',
|
||||||
_type: params.type || DEFAULT_SETTING_DOCTYPE,
|
_type: params.type || constants.DEFAULT_SETTING_DOCTYPE,
|
||||||
_id: params.id || uniqueId('testDoc'),
|
_id: params.id || uniqueId('testDoc'),
|
||||||
_version: 1,
|
_version: 1,
|
||||||
_shards: { total: shardCount, successful: shardCount, failed: 0 },
|
_shards: { total: shardCount, successful: shardCount, failed: 0 },
|
||||||
@@ -47,7 +47,7 @@ Client.prototype.get = function (params = {}, source = {}) {
|
|||||||
|
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
_index: params.index || 'index',
|
_index: params.index || 'index',
|
||||||
_type: params.type || DEFAULT_SETTING_DOCTYPE,
|
_type: params.type || constants.DEFAULT_SETTING_DOCTYPE,
|
||||||
_id: params.id || 'AVRPRLnlp7Ur1SZXfT-T',
|
_id: params.id || 'AVRPRLnlp7Ur1SZXfT-T',
|
||||||
_version: params.version || 1,
|
_version: params.version || 1,
|
||||||
found: true,
|
found: true,
|
||||||
@@ -59,7 +59,7 @@ 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',
|
||||||
_type: params.type || DEFAULT_SETTING_DOCTYPE,
|
_type: params.type || constants.DEFAULT_SETTING_DOCTYPE,
|
||||||
_id: uniqueId('documentId'),
|
_id: uniqueId('documentId'),
|
||||||
_version: random(1, 5),
|
_version: random(1, 5),
|
||||||
_score: null,
|
_score: null,
|
||||||
@@ -89,7 +89,7 @@ Client.prototype.update = function (params = {}) {
|
|||||||
const shardCount = 2;
|
const shardCount = 2;
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
_index: params.index || 'index',
|
_index: params.index || 'index',
|
||||||
_type: params.type || DEFAULT_SETTING_DOCTYPE,
|
_type: params.type || constants.DEFAULT_SETTING_DOCTYPE,
|
||||||
_id: params.id || uniqueId('testDoc'),
|
_id: params.id || uniqueId('testDoc'),
|
||||||
_version: params.version + 1 || 2,
|
_version: params.version + 1 || 2,
|
||||||
_shards: { total: shardCount, successful: shardCount, failed: 0 },
|
_shards: { total: shardCount, successful: shardCount, failed: 0 },
|
||||||
|
|||||||
Reference in New Issue
Block a user