diff --git a/package.json b/package.json index 34b5fe5..b12d921 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "lib/index.js", "scripts": { - "test": "npm run build && mocha --compilers js:babel-core/register test/**", + "test": "npm run build && mocha --compilers js:babel-core/register test/src/**", "build": "babel src --out-dir lib", "prepublish": "npm run test" }, diff --git a/test/fixtures/elasticsearch.js b/test/fixtures/elasticsearch.js new file mode 100644 index 0000000..a819029 --- /dev/null +++ b/test/fixtures/elasticsearch.js @@ -0,0 +1,6 @@ +function Client() {} +Client.prototype.index = function () {}; + +export default { + Client: Client +}; diff --git a/test/helpers/create_client.js b/test/src/helpers/create_client.js similarity index 78% rename from test/helpers/create_client.js rename to test/src/helpers/create_client.js index 11a94e0..fc0b7a1 100644 --- a/test/helpers/create_client.js +++ b/test/src/helpers/create_client.js @@ -1,11 +1,8 @@ import expect from 'expect.js'; import proxyquire from 'proxyquire'; +import * as elasticsearchMock from '../../fixtures/elasticsearch'; -const elasticsearchMock = { - Client: function Client() {} -}; - -const createClient = proxyquire.noPreserveCache()('../../lib/helpers/create_client', { +const createClient = proxyquire.noPreserveCache()('../../../lib/helpers/create_client', { elasticsearch: elasticsearchMock }); diff --git a/test/index.js b/test/src/index.js similarity index 89% rename from test/index.js rename to test/src/index.js index f75e46c..9469d89 100644 --- a/test/index.js +++ b/test/src/index.js @@ -1,4 +1,4 @@ -import Elastique from '../lib/index'; +import Elastique from '../../lib/index'; import expect from 'expect.js'; describe('Elastique class', function () { @@ -24,4 +24,9 @@ describe('Elastique class', function () { expect(init).to.throwException(/invalid.+protocol/i); }); }); + + describe('Job Creation', function () { + + }); + }); \ No newline at end of file