rename create client, fix client instance test

This commit is contained in:
2016-04-22 16:49:38 -07:00
parent 1171c5f0f1
commit 64945556ff
2 changed files with 11 additions and 5 deletions

View File

@@ -2,24 +2,25 @@ import expect from 'expect.js';
import proxyquire from 'proxyquire';
import * as elasticsearchMock from '../../fixtures/elasticsearch';
const createClient = proxyquire.noPreserveCache()('../../../lib/helpers/create_client', {
const module = proxyquire.noPreserveCache()('../../../lib/helpers/es_client', {
elasticsearch: elasticsearchMock
});
const createClient = module.default;
const { isClient } = module;
describe('Create client helper', function () {
it('should have a client', function () {
const options = {
host: 'http://localhost:9200'
};
const client = createClient(options);
expect(client).to.be.a(elasticsearchMock.Client);
expect(isClient(client)).to.be.ok();
});
it('should use passed in instance', function () {
const clientInstance = new elasticsearchMock.Client();
const client = createClient(clientInstance);
expect(client).to.equal(clientInstance);
});
});