add create_client tests
This commit is contained in:
28
test/helpers/create_client.js
Normal file
28
test/helpers/create_client.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import expect from 'expect.js';
|
||||
import proxyquire from 'proxyquire';
|
||||
|
||||
const elasticsearchMock = {
|
||||
Client: function Client() {}
|
||||
};
|
||||
|
||||
const createClient = proxyquire.noPreserveCache()('../../lib/helpers/create_client', {
|
||||
elasticsearch: elasticsearchMock
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
it('should use passed in instance', function () {
|
||||
const clientInstance = new elasticsearchMock.Client();
|
||||
const client = createClient(clientInstance);
|
||||
|
||||
expect(client).to.equal(clientInstance);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user