better elasticsearch client fixture
This commit is contained in:
14
test/fixtures/elasticsearch.js
vendored
14
test/fixtures/elasticsearch.js
vendored
@@ -1,5 +1,17 @@
|
||||
import { uniqueId } from 'lodash';
|
||||
|
||||
function Client() {}
|
||||
Client.prototype.index = function () {};
|
||||
Client.prototype.index = function (params) {
|
||||
var shardCount = 2;
|
||||
return Promise.resolve({
|
||||
_index: params.index || 'index',
|
||||
_type: params.type || 'type',
|
||||
_id: uniqueId('testDoc'),
|
||||
_version: 1,
|
||||
_shards: { total: shardCount, successful: shardCount, failed: 0 },
|
||||
created: true
|
||||
});
|
||||
};
|
||||
|
||||
export default {
|
||||
Client: Client
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('Jobs', function () {
|
||||
type = 'type1';
|
||||
payload = { id: '123' };
|
||||
options = { timeout: 1234 };
|
||||
sinon.stub(mockQueue.client, 'index');
|
||||
sinon.spy(mockQueue.client, 'index');
|
||||
});
|
||||
|
||||
it('should index the payload', function () {
|
||||
|
||||
Reference in New Issue
Block a user